<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/EncryptedArray.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">EncryptedArray.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_encrypted_array_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_ENCRYPTEDARRAY_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_ENCRYPTEDARRAY_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;exception&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;complex&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;NTL/Lazy.h&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;NTL/pair.h&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;NTL/SmartPtr.h&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_double_c_r_t_8h.html">helib/DoubleCRT.h</a>&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_context_8h.html">helib/Context.h</a>&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_ctxt_8h.html">helib/Ctxt.h</a>&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="keys_8h.html">helib/keys.h</a>&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">   32</a></span>&#160;<span class="keyword">typedef</span> std::complex&lt;double&gt; <a class="code" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">cx_double</a>;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment">// DIRT: we&#39;re using undocumented NTL interfaces here</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">//   also...this probably should be defined in NTL, anyway....</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#define HELIB_MORE_UNWRAPARGS(n)                                               \</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="_encrypted_array_8h.html#a0643e00a065b8bfad80c0639f90178e5">   37</a></span>&#160;<span class="preprocessor">  NTL_SEPARATOR_##n NTL_REPEATER_##n(NTL_UNWRAPARG)</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">// these are used to implement PlaintextArray stuff routines</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">// NOTE: Variables have been marked as UNUSED to silence the unused variable</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">// warnings due to unused injected variables. It has not been possible to mark</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">// the whole section with:</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">// _Pragma(&quot;GCC diagnostic ignored \&quot;-Wunused-variable\&quot;&quot;) because GCC 5.4 does</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">// not honor such _Pragma.</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">// NOTE: Consider marking the section with _Pragma removing the UNUSED tag when</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">// GCC 5.4 won&#39;t be supported anymore.</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#define PA_BOILER                                                              \</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="_encrypted_array_8h.html#a2206773b8be2edfab7070fd85b35d92c">   49</a></span>&#160;<span class="preprocessor">  const PAlgebraModDerived&lt;type&gt;&amp; tab = ea.getTab();                           \</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">  UNUSED const RX&amp; G = ea.getG();                                              \</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">  UNUSED long n = ea.size();                                                   \</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">  UNUSED long d = ea.getDegree();                                              \</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">  std::vector&lt;RX&gt;&amp; data = pa.getData&lt;type&gt;();                                  \</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="preprocessor">  RBak bak;                                                                    \</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="preprocessor">  bak.save();                                                                  \</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">  tab.restoreContext();</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">// NOTE: Variables have been marked as UNUSED to silence the unused variable</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment">// warnings due to unused injected variables. It has not been possible to mark</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment">// the whole section with:</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="comment">// _Pragma(&quot;GCC diagnostic ignored \&quot;-Wunused-variable\&quot;&quot;) because GCC 5.4 does</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="comment">// not honor such _Pragma.</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="comment">// NOTE: Consider marking the section with _Pragma removing the UNUSED tag when</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="comment">// GCC 5.4 won&#39;t be supported anymore.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#define CPA_BOILER                                                             \</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="_encrypted_array_8h.html#ae9b76bfef96a97dcb98913fcac4b322f">   66</a></span>&#160;<span class="preprocessor">  const PAlgebraModDerived&lt;type&gt;&amp; tab = ea.getTab();                           \</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">  UNUSED const RX&amp; G = ea.getG();                                              \</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">  UNUSED long n = ea.size();                                                   \</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">  UNUSED long d = ea.getDegree();                                              \</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="preprocessor">  const std::vector&lt;RX&gt;&amp; data = pa.getData&lt;type&gt;();                            \</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">  RBak bak;                                                                    \</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="preprocessor">  bak.save();                                                                  \</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">  tab.restoreContext();</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword">class </span>PlaintextArray; <span class="comment">// forward reference</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="keyword">class </span>EncryptedArray; <span class="comment">// forward reference</span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; </div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html">  112</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;{ <span class="comment">// purely abstract interface</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a3fcb15513e4d89d0c0ed4bda3fca2190">  115</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a3fcb15513e4d89d0c0ed4bda3fca2190">~EncryptedArrayBase</a>() {}</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#aff3d839e2e2976ef8c87853cf5a9cbb7">  117</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a>* <a class="code" href="classhelib_1_1_encrypted_array_base.html#aff3d839e2e2976ef8c87853cf5a9cbb7">clone</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="comment">// makes this usable with cloned_ptr</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a5fe975d2c45ef2f25aaf5920c91627fe">  120</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7e">PA_tag</a> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a5fe975d2c45ef2f25aaf5920c91627fe">getTag</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a953777c1f618b3f77cb06981f39dce99">  122</a></span>&#160;  <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_base.html#a953777c1f618b3f77cb06981f39dce99">getContext</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">  123</a></span>&#160;  <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra.html">PAlgebra</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a385a1b684e2ff6346f7b8e7425a6aacb">  124</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a385a1b684e2ff6346f7b8e7425a6aacb">getDegree</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a4b575e110984970e2f56f6b04731f55a">  125</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4b575e110984970e2f56f6b04731f55a">getP2R</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ab02ad165d8df163bc6d8c544f8f81bbd">  129</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ab02ad165d8df163bc6d8c544f8f81bbd">rotate</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a72245213a18b9bafdd8ebc2396972c14">  133</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a72245213a18b9bafdd8ebc2396972c14">shift</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a3beed1bc134ad9a4dbe6f6c4f456fee7">  139</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a3beed1bc134ad9a4dbe6f6c4f456fee7">rotate1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k, <span class="keywordtype">bool</span> dc = <span class="keyword">false</span>) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a2461039fb77ebf3fea8482adff2b40c0">  142</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a2461039fb77ebf3fea8482adff2b40c0">shift1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160; </div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a05e74964d2a8246b2c197251d6426faa">  149</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a05e74964d2a8246b2c197251d6426faa">badDimensionAutomorphCorrection</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;                                               <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                                               <span class="keywordtype">long</span> amt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160; </div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  <span class="comment">// encode/decode arrays into plaintext polynomials</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  <span class="comment">// These methods are working for some of the derived classes (throwing</span></div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;  <span class="comment">// otherwise)</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a93bf7ceecb7cef0259b5eddeb25a3c28">  158</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a93bf7ceecb7cef0259b5eddeb25a3c28">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a6c08875c23130ae7eeea11189b5c50cf">  159</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a6c08875c23130ae7eeea11189b5c50cf">encode</a>(NTL::ZZX&amp; ptxt, <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a64f75f243718856305758a8a39834a00">  161</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a64f75f243718856305758a8a39834a00">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;zzX&gt;&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a8b461cfa84f1751ad0db61a80ff5c7e8">  162</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a8b461cfa84f1751ad0db61a80ff5c7e8">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160; </div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a4c1ee4078df5f248d96b30dd5676783e">  164</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4c1ee4078df5f248d96b30dd5676783e">encode</a>(NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                      <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#af769f314f80561d0aad9420aabc98a86">  166</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#af769f314f80561d0aad9420aabc98a86">encode</a>(NTL::ZZX&amp; ptxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a8f11ae63a7511a016c1ba28f293930a0">  168</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a8f11ae63a7511a016c1ba28f293930a0">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    NTL::ZZX tmp;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#a93bf7ceecb7cef0259b5eddeb25a3c28">encode</a>(tmp, array);</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(ptxt, tmp);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;  <span class="comment">// These methods are working for some of the derived classes (throwing</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;  <span class="comment">// otherwise)</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#aacbeee1b5623eeec1d2c8ca311654cc7">  177</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aacbeee1b5623eeec1d2c8ca311654cc7">decode</a>(std::vector&lt;long&gt;&amp; array, <span class="keyword">const</span> NTL::ZZX&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a034157a2fb376284fa951f20570e02d0">  178</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a034157a2fb376284fa951f20570e02d0">decode</a>(std::vector&lt;NTL::ZZX&gt;&amp; array,</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                      <span class="keyword">const</span> NTL::ZZX&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a789cc5597002e684315cabbef6c42de8">  180</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a789cc5597002e684315cabbef6c42de8">decode</a>(<a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array, <span class="keyword">const</span> NTL::ZZX&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160; </div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#aee2981f3b0804e96f83106307d9c5be9">  182</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aee2981f3b0804e96f83106307d9c5be9">random</a>(std::vector&lt;long&gt;&amp; array) <span class="keyword">const</span> = 0; <span class="comment">// must be defined</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;  <span class="comment">// These methods are working for some of the derived classes (throwing</span></div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;  <span class="comment">// otherwise)</span></div>
<div class="line"><a name="l00186"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a54e197fb8f924535b79bf1cb0fd62ce3">  186</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a54e197fb8f924535b79bf1cb0fd62ce3">random</a>(std::vector&lt;NTL::ZZX&gt;&amp; array) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;  <span class="comment">// FIXME: Inefficient implementation, calls usual decode and returns one slot</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ab9b7baf29ff926acd6cfa8b8d00bf800">  189</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ab9b7baf29ff926acd6cfa8b8d00bf800">decode1Slot</a>(<span class="keyword">const</span> NTL::ZZX&amp; ptxt, <span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    std::vector&lt;long&gt; v;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#aacbeee1b5623eeec1d2c8ca311654cc7">decode</a>(v, ptxt);</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="keywordflow">return</span> v.at(i);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;  }</div>
<div class="line"><a name="l00195"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#acfdec26873763a9b20daf3206a273146">  195</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#acfdec26873763a9b20daf3206a273146">decode1Slot</a>(NTL::ZZX&amp; slot, <span class="keyword">const</span> NTL::ZZX&amp; ptxt, <span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    std::vector&lt;NTL::ZZX&gt; v;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#aacbeee1b5623eeec1d2c8ca311654cc7">decode</a>(v, ptxt);</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    slot = v.at(i);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;  }</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160; </div>
<div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ae87dba346c9f27331e552edd1511552f">  203</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ae87dba346c9f27331e552edd1511552f">encodeUnitSelector</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">long</span> i) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160; </div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT&gt;</div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ade59fa0a4bceb030a895d725ee1f7d88">  209</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ade59fa0a4bceb030a895d725ee1f7d88">encrypt</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; key, <span class="keyword">const</span> PTXT&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;<a class="code" href="classhelib_1_1_encrypted_array_base.html#a953777c1f618b3f77cb06981f39dce99">getContext</a>(),</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;             &amp;ctxt.<a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>(),</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;             <span class="stringliteral">&quot;Cannot encrypt when ciphertext has different context than &quot;</span></div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;             <span class="stringliteral">&quot;EncryptedArray&quot;</span>);</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> pp;</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#a93bf7ceecb7cef0259b5eddeb25a3c28">encode</a>(pp, ptxt); <span class="comment">// Convert array of slots into a plaintext polynomial</span></div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    key.<a class="code" href="classhelib_1_1_pub_key.html#a0346c2c214b648809f6b754de9e5d431">Encrypt</a>(ctxt, pp, <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4b575e110984970e2f56f6b04731f55a">getP2R</a>()); <span class="comment">// encrypt the plaintext polynomial</span></div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    <span class="comment">// NOTE: If secret key, will call the overridden SecKey::Encrypt</span></div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    <span class="comment">// FIXME: the &quot;false&quot; param forces the PK version</span></div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;  }</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160; </div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;  <span class="comment">// These methods are working for some of the derived calsses (throwing</span></div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;  <span class="comment">// otherwise)</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a4e8c39c8730c5072e36f37aaa28eccbb">  224</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4e8c39c8730c5072e36f37aaa28eccbb">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;                       std::vector&lt;long&gt;&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ae31ef3579ef0b0d6cba0f805a9c80f50">  227</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ae31ef3579ef0b0d6cba0f805a9c80f50">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;                       std::vector&lt;NTL::ZZX&gt;&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a96caa13ce77bdabc4b7d679c28213c73">  230</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a96caa13ce77bdabc4b7d679c28213c73">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;                       <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a4883d910df8cf214986647f84eb7531c">  233</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4883d910df8cf214986647f84eb7531c">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;                       std::vector&lt;double&gt;&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00236"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a000a070007229db34150a3dcbb45f886">  236</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a000a070007229db34150a3dcbb45f886">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                       std::vector&lt;cx_double&gt;&amp; ptxt) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160; </div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;  <span class="comment">// FIXME: Inefficient implementation, calls usual decrypt and returns one slot</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#acb343e9ad9fe202a7386fc8359346a02">  241</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#acb343e9ad9fe202a7386fc8359346a02">decrypt1Slot</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    std::vector&lt;long&gt; v;</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4e8c39c8730c5072e36f37aaa28eccbb">decrypt</a>(ctxt, sKey, v);</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    <span class="keywordflow">return</span> v.at(i);</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;  }</div>
<div class="line"><a name="l00247"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a454ee083696fe4e2b56ed18dae023722">  247</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a454ee083696fe4e2b56ed18dae023722">decrypt1Slot</a>(NTL::ZZX&amp; slot,</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;                    <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;                    <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;                    <span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    std::vector&lt;NTL::ZZX&gt; v;</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#a4e8c39c8730c5072e36f37aaa28eccbb">decrypt</a>(ctxt, sKey, v);</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    slot = v.at(i);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;  }</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160; </div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;  <span class="comment">// These methods are working for some of the derived calsses (throwing</span></div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;  <span class="comment">// otherwise)</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a20cdc66014104dd640f37c1c92e1fa05">  268</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a20cdc66014104dd640f37c1c92e1fa05">buildLinPolyCoeffs</a>(std::vector&lt;NTL::ZZX&gt;&amp; C,</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;                                  <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; L) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160; </div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;  <span class="comment">// restore contexts mod p and mod G</span></div>
<div class="line"><a name="l00272"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a3829a9890ce25a65bdb5111bf2bdd687">  272</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a3829a9890ce25a65bdb5111bf2bdd687">restoreContext</a>()<span class="keyword"> const </span>{}</div>
<div class="line"><a name="l00273"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#ae5927ca8c689a115ee2c12522289255f">  273</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#ae5927ca8c689a115ee2c12522289255f">restoreContextForG</a>()<span class="keyword"> const </span>{}</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160; </div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;  <span class="comment">/* some non-virtual convenience functions */</span></div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160; </div>
<div class="line"><a name="l00278"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">  278</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#a5a90fd828a817490c390947228ecf928">getNSlots</a>(); }</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160; </div>
<div class="line"><a name="l00281"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a5741ce03114f74e26d3d842e3539806a">  281</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a5741ce03114f74e26d3d842e3539806a">dimension</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#a5e4b044f71ca8edcfa4426cb199461f0">numOfGens</a>(); }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160; </div>
<div class="line"><a name="l00284"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a7b4ebc9251cd7e1966c5da70f51fb369">  284</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a7b4ebc9251cd7e1966c5da70f51fb369">sizeOfDimension</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#ab01ff1a6b2a0eceba09d688a933de360">OrderOf</a>(i); }</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160; </div>
<div class="line"><a name="l00287"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a368c21a272921966da3a7793145bf5d2">  287</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a368c21a272921966da3a7793145bf5d2">nativeDimension</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#a427d4228e407fbf694191ad18842e90d">SameOrd</a>(i); }</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160; </div>
<div class="line"><a name="l00290"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#a1f4d4caa1e488648194495688a06a6a3">  290</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#a1f4d4caa1e488648194495688a06a6a3">coordinate</a>(<span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k)<span class="keyword"> const</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#afb2bad9633f98f52f81a7670c0d9bef4">coordinate</a>(i, k);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;  }</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160; </div>
<div class="line"><a name="l00296"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#af55d2066263a1a0f6abd9ab221a61f0c">  296</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#af55d2066263a1a0f6abd9ab221a61f0c">addCoord</a>(<span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k, <span class="keywordtype">long</span> offset)<span class="keyword"> const</span></div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">getPAlgebra</a>().<a class="code" href="classhelib_1_1_p_algebra.html#adfc198eb325759da0eb07e1edad86a2b">addCoord</a>(i, k, offset);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;  }</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160; </div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U&gt;</div>
<div class="line"><a name="l00304"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_base.html#aefb676e30745c2ce81df0384cf949df7">  304</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html#aefb676e30745c2ce81df0384cf949df7">rotate1D</a>(std::vector&lt;U&gt;&amp; out,</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;                <span class="keyword">const</span> std::vector&lt;U&gt;&amp; in,</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;                <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;                <span class="keywordtype">long</span> offset)<span class="keyword"> const</span></div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(<a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in),</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;             <a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>(),</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;             <span class="stringliteral">&quot;Input vector has wrong size (must equal EncryptedArray::size())&quot;</span>);</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    out.resize(in.size());</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> j = 0; j &lt; <a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>(); j++)</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;      out[<a class="code" href="classhelib_1_1_encrypted_array_base.html#af55d2066263a1a0f6abd9ab221a61f0c">addCoord</a>(i, j, offset)] = in[j];</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;  }</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;};</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160; </div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l00323"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html">  323</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived</a> : <span class="keyword">public</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a></div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;{</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;  <a class="code" href="_p_algebra_8h.html#a3f121e88d1ede1fd384a8ad4ebb51f41">PA_INJECT</a>(type)</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context;</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod_derived.html">PAlgebraModDerived&lt;type&gt;</a>&amp; tab;</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160; </div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;  <span class="comment">// FIXME: all of these types should be copyable</span></div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;  <span class="comment">// out of context, but NTL 8.0 still does not copy</span></div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;  <span class="comment">// matrix copies out of context correctly, as it</span></div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;  <span class="comment">// relies on plain SetLength...I need to fix this</span></div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;  <span class="comment">// in NTL</span></div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;  <span class="comment">//</span></div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;  <a class="code" href="classhelib_1_1_mapping_data.html">MappingData&lt;type&gt;</a> mappingData; <span class="comment">// MappingData is defined in PAlgebra.h</span></div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160; </div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;  NTL::Lazy&lt;NTL::Mat&lt;RE&gt;&gt; linPolyMatrix;</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160; </div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;  NTL::Lazy&lt;NTL::Pair&lt;NTL::Mat&lt;R&gt;, NTL::Mat&lt;R&gt;&gt;&gt; normalBasisMatrices;</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;  <span class="comment">// a is the matrix, b is its inverse</span></div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160; </div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a795ee815c4701c02b683c7bb3a9a3518">EncryptedArrayDerived</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; _context,</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;                                 <span class="keyword">const</span> RX&amp; _G,</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;                                 <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod.html">PAlgebraMod</a>&amp; _tab);</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160; </div>
<div class="line"><a name="l00350"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ab3f8765108fc68df6296afb4845da57d">  350</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ab3f8765108fc68df6296afb4845da57d">EncryptedArrayDerived</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived</a>&amp; other) <span class="comment">// copy constructor</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;      :</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;      context(other.context), tab(other.tab)</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;  {</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    bak.save();</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    REBak ebak;</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    ebak.save();</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;    other.mappingData.restoreContextForG();</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;    mappingData = other.mappingData;</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    linPolyMatrix = other.linPolyMatrix;</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    normalBasisMatrices = other.normalBasisMatrices;</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;  }</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160; </div>
<div class="line"><a name="l00365"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ae0cdc66cd6ea14bb1fa9b3748286b086">  365</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ae0cdc66cd6ea14bb1fa9b3748286b086">operator=</a>(</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived</a>&amp; other) <span class="comment">// assignment</span></div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;  {</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;    <span class="keywordflow">if</span> (<span class="keyword">this</span> == &amp;other)</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;      <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;context,</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;             &amp;other.context,</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;             <span class="stringliteral">&quot;Cannot assign a EncryptedArrays with different contexts&quot;</span>);</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;tab,</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;             &amp;other.tab,</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;             <span class="stringliteral">&quot;Cannot assign a EncryptedArrays with different tabs&quot;</span>);</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160; </div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    bak.save();</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    mappingData = other.mappingData;</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    linPolyMatrix = other.linPolyMatrix;</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;    normalBasisMatrices = other.normalBasisMatrices;</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;  }</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160; </div>
<div class="line"><a name="l00386"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ae80adc5a72904c36d8c174ee032b7208">  386</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a>* <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ae80adc5a72904c36d8c174ee032b7208">clone</a>()<span class="keyword"> const override</span></div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a795ee815c4701c02b683c7bb3a9a3518">EncryptedArrayDerived</a>(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;  }</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160; </div>
<div class="line"><a name="l00391"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a1f1568cce42e1f8b91d9edceb5b8329a">  391</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7e">PA_tag</a> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a1f1568cce42e1f8b91d9edceb5b8329a">getTag</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> tag; }</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;  <span class="comment">// tag is defined in PA_INJECT, see PAlgebra.h</span></div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>T, <span class="keyword">typename</span>... Args&gt;</div>
<div class="line"><a name="l00395"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a148c2b99586850a69ca19ab2b7fd562e">  395</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a148c2b99586850a69ca19ab2b7fd562e">dispatch</a>(Args&amp;&amp;... args)<span class="keyword"> const</span></div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    T&lt;type&gt;::apply(*<span class="keyword">this</span>, std::forward&lt;Args&gt;(args)...);</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;  }</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160; </div>
<div class="line"><a name="l00400"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a4a081671bfa69eb6938d12446bbc4853">  400</a></span>&#160;  <span class="keyword">const</span> RX&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a4a081671bfa69eb6938d12446bbc4853">getG</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mappingData.<a class="code" href="classhelib_1_1_mapping_data.html#aedaecfbec10f647a8bfafee57c4f5b9f">getG</a>(); }</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160; </div>
<div class="line"><a name="l00402"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a5ae779d5f0fd91f5d5846d5fc1d4fc15">  402</a></span>&#160;  <span class="keyword">const</span> NTL::Mat&lt;R&gt;&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a5ae779d5f0fd91f5d5846d5fc1d4fc15">getNormalBasisMatrix</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;    <span class="keywordflow">if</span> (!normalBasisMatrices.built())</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;      <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a540b5ea6214812fa2414044923c3a035">initNormalBasisMatrix</a>();</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    <span class="keywordflow">return</span> normalBasisMatrices-&gt;a;</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;  }</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00409"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a334f5f8c9e7d0f951c117b200efe127d">  409</a></span>&#160;  <span class="keyword">const</span> NTL::Mat&lt;R&gt;&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a334f5f8c9e7d0f951c117b200efe127d">getNormalBasisMatrixInverse</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;    <span class="keywordflow">if</span> (!normalBasisMatrices.built())</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;      <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a540b5ea6214812fa2414044923c3a035">initNormalBasisMatrix</a>();</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    <span class="keywordflow">return</span> normalBasisMatrices-&gt;b;</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;  }</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160; </div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a540b5ea6214812fa2414044923c3a035">initNormalBasisMatrix</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a95c835acdb8766ca3a9e733195dedba7">  418</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a95c835acdb8766ca3a9e733195dedba7">restoreContext</a>()<span class="keyword"> const override </span>{ tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>(); }</div>
<div class="line"><a name="l00419"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a334aac82a4217163cd7f3e0a8da7eb9b">  419</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a334aac82a4217163cd7f3e0a8da7eb9b">restoreContextForG</a>()<span class="keyword"> const override</span></div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;    mappingData.<a class="code" href="classhelib_1_1_mapping_data.html#a0939fcc81b1ac4033a8a165ecd220ae1">restoreContextForG</a>();</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;  }</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160; </div>
<div class="line"><a name="l00424"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#aedb467d9a37f866be26575bcdebe4401">  424</a></span>&#160;  <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#aedb467d9a37f866be26575bcdebe4401">getContext</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> context; }</div>
<div class="line"><a name="l00425"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#aee12c18cec9f25f2e8b4208c7d32d1f7">  425</a></span>&#160;  <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra.html">PAlgebra</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#aee12c18cec9f25f2e8b4208c7d32d1f7">getPAlgebra</a>()<span class="keyword"> const override</span></div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;    <span class="keywordflow">return</span> tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#aa63328efb58148204ed8a95287be7c19">getZMStar</a>();</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;  }</div>
<div class="line"><a name="l00429"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a1aa2691c70360cbb4836ab9d220ce245">  429</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a1aa2691c70360cbb4836ab9d220ce245">getDegree</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> mappingData.<a class="code" href="classhelib_1_1_mapping_data.html#af2df06fc054ae5ea95959c3b5c1db8ca">getDegG</a>(); }</div>
<div class="line"><a name="l00430"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a9741ce6601a5d07c83283beeff6cc7e0">  430</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod_derived.html">PAlgebraModDerived&lt;type&gt;</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a9741ce6601a5d07c83283beeff6cc7e0">getTab</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> tab; }</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160; </div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a1c0a250013b889509a852aa74e3c29f0">rotate</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a47944c462c09ff14b3d8dda332e66325">shift</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ac09d307b1cceced22a6c5717c467b3e7">rotate1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;                        <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;                        <span class="keywordtype">long</span> k,</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;                        <span class="keywordtype">bool</span> dc = <span class="keyword">false</span>) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160; </div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a578731eb6f1c9ee5c992e8cb8108a7bf">badDimensionAutomorphCorrection</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;                                               <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;                                               <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160; </div>
<div class="line"><a name="l00443"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a7b245c39644ac52a7040ba18f57ad704">  443</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a7b245c39644ac52a7040ba18f57ad704">getP2R</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a9741ce6601a5d07c83283beeff6cc7e0">getTab</a>().getPPowR(); }</div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160; </div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;  <span class="comment">// avoid this being &quot;hidden&quot; by other rotate1D&#39;s</span></div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U&gt;</div>
<div class="line"><a name="l00447"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a4008456c8aaeaf459a8ee001b1dbf21f">  447</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a4008456c8aaeaf459a8ee001b1dbf21f">rotate1D</a>(std::vector&lt;U&gt;&amp; out,</div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;                <span class="keyword">const</span> std::vector&lt;U&gt;&amp; in,</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;                <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;                <span class="keywordtype">long</span> offset)<span class="keyword"> const</span></div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_base.html#a3beed1bc134ad9a4dbe6f6c4f456fee7">EncryptedArrayBase::rotate1D</a>(out, in, i, offset);</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;  }</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ac07a62371be0a1c0ad617a04e147e000">shift1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160; </div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;  <span class="comment">/* Begin CKKS functions. They will simply throw here. */</span></div>
<div class="line"><a name="l00464"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a551593e093a3e2e49028d3522da86906">  464</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a551593e093a3e2e49028d3522da86906">decrypt</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;double&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: &quot;</span></div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;                     <span class="stringliteral">&quot;EncryptedArrayDerived::decrypt for CKKS type&quot;</span>);</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;  }</div>
<div class="line"><a name="l00478"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a449d1c41fe9b41dd8c45f63ce6e4de89">  478</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a449d1c41fe9b41dd8c45f63ce6e4de89">decrypt</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;cx_double&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: &quot;</span></div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;                     <span class="stringliteral">&quot;EncryptedArrayDerived::decrypt for CKKS type&quot;</span>);</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;  }</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;  <span class="comment">/* End CKKS functions. */</span></div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160; </div>
<div class="line"><a name="l00487"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">  487</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;                      <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    genericEncode(ptxt, array);</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;  }</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160; </div>
<div class="line"><a name="l00493"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a7c69526bbb217d9731e628af68585b26">  493</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a7c69526bbb217d9731e628af68585b26">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    genericEncode(ptxt, array);</div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;  }</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160; </div>
<div class="line"><a name="l00498"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a80cc816a32404a8dc6e9a7ad28a2b810">  498</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a80cc816a32404a8dc6e9a7ad28a2b810">encode</a>(NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;                      <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;    genericEncode(ptxt, array);</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;  }</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160; </div>
<div class="line"><a name="l00504"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a377168a9d05375ab76ce34d8f6631582">  504</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a377168a9d05375ab76ce34d8f6631582">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;zzX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;    genericEncode(ptxt, array);</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;  }</div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160; </div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;                      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160; </div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a77cc1a6041c4d442bb3a3858afc5f12c">encodeUnitSelector</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">long</span> i) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160; </div>
<div class="line"><a name="l00515"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">  515</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(std::vector&lt;long&gt;&amp; array,</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;                      <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;    genericDecode(array, ptxt);</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;  }</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160; </div>
<div class="line"><a name="l00521"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ab46f85fab47332239f119caee09ececf">  521</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ab46f85fab47332239f119caee09ececf">decode</a>(std::vector&lt;NTL::ZZX&gt;&amp; array,</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;                      <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;    genericDecode(array, ptxt);</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;  }</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160; </div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(<a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array,</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;                      <span class="keyword">const</span> NTL::ZZX&amp; ptxt) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(<a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160; </div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;  <span class="comment">// choose at random and convert to std::vector&lt;long&gt;</span></div>
<div class="line"><a name="l00532"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a14f8a3b077bab6c697efc921fe358178">  532</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a14f8a3b077bab6c697efc921fe358178">random</a>(std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;    genericRandom(array);</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;  }</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160; </div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;  <span class="comment">// choose at random and convert to std::vector&lt;ZZX&gt;</span></div>
<div class="line"><a name="l00538"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a9b0e39d0510ca716372034ee14786c56">  538</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a9b0e39d0510ca716372034ee14786c56">random</a>(std::vector&lt;NTL::ZZX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;    genericRandom(array);</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;  }</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160; </div>
<div class="line"><a name="l00543"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a579c0568094fd700b471567ee82f731c">  543</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a579c0568094fd700b471567ee82f731c">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;                       std::vector&lt;long&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;    genericDecrypt(ctxt, sKey, ptxt);</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;    <span class="keywordflow">if</span> (ctxt.<a class="code" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">getPtxtSpace</a>() &lt; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a7b245c39644ac52a7040ba18f57ad704">getP2R</a>()) {</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; (long)ptxt.size(); i++)</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;        ptxt[i] %= ctxt.<a class="code" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">getPtxtSpace</a>();</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;    }</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;  }</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160; </div>
<div class="line"><a name="l00554"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a67585c6eeb53cb6bcd1f48f41f9e05a9">  554</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a67585c6eeb53cb6bcd1f48f41f9e05a9">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;                       std::vector&lt;NTL::ZZX&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    genericDecrypt(ctxt, sKey, ptxt);</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;    <span class="keywordflow">if</span> (ctxt.<a class="code" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">getPtxtSpace</a>() &lt; <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a7b245c39644ac52a7040ba18f57ad704">getP2R</a>()) {</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;      <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; (long)ptxt.size(); i++)</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;        <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(ptxt[i], ctxt.<a class="code" href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">getPtxtSpace</a>(), <span class="comment">/*abs=*/</span><span class="keyword">true</span>);</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;    }</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;  }</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160; </div>
<div class="line"><a name="l00565"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ae4f2249cd0f9cebc2539ba2609780ae1">  565</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ae4f2249cd0f9cebc2539ba2609780ae1">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;                       <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;                       <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;    genericDecrypt(ctxt, sKey, ptxt);</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;    <span class="comment">// FIXME: Reduce mod the ciphertext plaintext space as above</span></div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;  }</div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160; </div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ac12a59e0c752ad844b5442f8df150449">buildLinPolyCoeffs</a>(</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;      std::vector&lt;NTL::ZZX&gt;&amp; C,</div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;      <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; L) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160; </div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;  <span class="comment">/* the following are specialized methods, used to work over extension</span></div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;<span class="comment">     fields... they assume the modulus context is already set</span></div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160; </div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> std::vector&lt;RX&gt;&amp; array) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(std::vector&lt;RX&gt;&amp; array, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160; </div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(NTL::ZZX&amp; ptxt, <span class="keyword">const</span> std::vector&lt;RX&gt;&amp; array) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(std::vector&lt;RX&gt;&amp; array, <span class="keyword">const</span> NTL::ZZX&amp; ptxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160; </div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(RX&amp; ptxt, <span class="keyword">const</span> std::vector&lt;RX&gt;&amp; array) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(std::vector&lt;RX&gt;&amp; array, <span class="keyword">const</span> RX&amp; ptxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160; </div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;  <span class="comment">// Choose random polynomial of the right degree, coeffs in GF2 or zz_p</span></div>
<div class="line"><a name="l00591"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#ad307509bc693f875334cd67b84ba401d">  591</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ad307509bc693f875334cd67b84ba401d">random</a>(std::vector&lt;RX&gt;&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;    array.resize(<a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>());</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; <a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>(); i++)</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;      <a class="code" href="namespacehelib.html#a38c7c1b517a8ec41eacfc5c2dba6e293">NTL::random</a>(array[i], <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a1aa2691c70360cbb4836ab9d220ce245">getDegree</a>());</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;  }</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160; </div>
<div class="line"><a name="l00598"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_derived.html#a20151d8001b05fadd502f4992079dd1c">  598</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a20151d8001b05fadd502f4992079dd1c">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;               <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;               std::vector&lt;RX&gt;&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    genericDecrypt(ctxt, sKey, ptxt);</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;  }</div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160; </div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html#ac12a59e0c752ad844b5442f8df150449">buildLinPolyCoeffs</a>(std::vector&lt;RX&gt;&amp; C,</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;                                  <span class="keyword">const</span> std::vector&lt;RX&gt;&amp; L) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160; </div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;  <span class="comment">/* helper template methods, to avoid repetitive code */</span></div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160; </div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;  <span class="keywordtype">void</span> genericEncode(NTL::ZZX&amp; ptxt, <span class="keyword">const</span> T&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    bak.save();</div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160; </div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;    std::vector&lt;RX&gt; array1;</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(array1, array);</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(ptxt, array1);</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;  }</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160; </div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;  <span class="keywordtype">void</span> genericEncode(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keyword">const</span> T&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;    bak.save();</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160; </div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;    std::vector&lt;RX&gt; array1;</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(array1, array);</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">encode</a>(ptxt, array1);</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;  }</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160; </div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;  <span class="keywordtype">void</span> genericDecode(T&amp; array, <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;    bak.save();</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160; </div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;    std::vector&lt;RX&gt; array1;</div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(array1, ptxt);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(array, array1);</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;  }</div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160; </div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;  <span class="comment">// T is std::vector&lt;long&gt; or std::vector&lt;ZZX&gt;</span></div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;  <span class="keywordtype">void</span> genericRandom(T&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;    static_assert(std::is_same&lt;T, std::vector&lt;long&gt;&gt;::value ||</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;                      std::is_same&lt;T, std::vector&lt;NTL::ZZX&gt;&gt;::value,</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;                  <span class="stringliteral">&quot;Template type T must be either std::vector&lt;long&gt; or &quot;</span></div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;                  <span class="stringliteral">&quot;std::vector&lt;NTL::ZZX&gt;.&quot;</span>);</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;    RBak bak;</div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;    <span class="comment">// backup NTL modulus</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;    bak.save();</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;    tab.<a class="code" href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">restoreContext</a>();</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160; </div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;    std::vector&lt;RX&gt; array1; <span class="comment">// RX is GF2X or zz_pX</span></div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_derived.html#a14f8a3b077bab6c697efc921fe358178">random</a>(array1);         <span class="comment">// choose random coefficients from GF2/zz_p</span></div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(array, array1); <span class="comment">// convert to type T (see NumbTh.h)</span></div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;  }</div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160; </div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;  <span class="keywordtype">void</span> genericDecrypt(<span class="keyword">const</span> Ctxt&amp; ctxt, <span class="keyword">const</span> SecKey&amp; sKey, T&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;context,</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;             &amp;ctxt.getContext(),</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;             <span class="stringliteral">&quot;Cannot decrypt when ciphertext has different context than &quot;</span></div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;             <span class="stringliteral">&quot;EncryptedArray&quot;</span>);</div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;    NTL::ZZX pp;</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;    sKey.Decrypt(pp, ctxt);</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">decode</a>(array, pp);</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;  }</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;};</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160; </div>
<div class="line"><a name="l00679"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html">  679</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_encrypted_array_cx.html">EncryptedArrayCx</a> : <span class="keyword">public</span> <a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a></div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;{</div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context;</div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod_cx.html">PAlgebraModCx</a>&amp; alMod;</div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;  <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> iEncoded; <span class="comment">// an encoded plaintext with i in all the slots</span></div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160; </div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00686"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a84a23e382804d2ed776dd7eebe65c41e">  686</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a84a23e382804d2ed776dd7eebe65c41e">roundedSize</a>(<span class="keywordtype">double</span> x)</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;  {</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;    <span class="keywordtype">long</span> rounded = ceil(fabs(x));</div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;    <span class="keywordflow">if</span> (rounded &lt; 1)</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;      rounded = 1;</div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;    <span class="keywordflow">return</span> double(1L &lt;&lt; NTL::NumBits(rounded - 1));</div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;  }</div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160; </div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8816c7ea0d50a3667a7c9a4aaab903d5">encodei</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">long</span> precision = -1) <span class="keyword">const</span>; <span class="comment">// encode i in all slots</span></div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160; </div>
<div class="line"><a name="l00696"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a759888cad7e21adc991832246d9ca3a2">  696</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a759888cad7e21adc991832246d9ca3a2">EncryptedArrayCx</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; _context) :</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;      context(_context), alMod(context.alMod.getCx())</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;  {</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;    <a class="code" href="namespacehelib.html#ada22455ae91e6bacc49e719536a8c5da">clear</a>(iEncoded);</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;  }</div>
<div class="line"><a name="l00701"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a79103ed28e86f05ca8c141758b6bcac9">  701</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a79103ed28e86f05ca8c141758b6bcac9">EncryptedArrayCx</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; _context, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod_cx.html">PAlgebraModCx</a>&amp; _alMod) :</div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;      context(_context), alMod(_alMod)</div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;  {</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;    <a class="code" href="namespacehelib.html#ada22455ae91e6bacc49e719536a8c5da">clear</a>(iEncoded);</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;  }</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160; </div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;  <span class="comment">// conversion between std::vectors of complex, real, and integers</span></div>
<div class="line"><a name="l00708"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">  708</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(std::vector&lt;cx_double&gt;&amp; out,</div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;                      <span class="keyword">const</span> std::vector&lt;double&gt;&amp; in)</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;  {</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;    <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(out, <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in));</div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in); i++)</div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;      out[i] = in[i];</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;  }</div>
<div class="line"><a name="l00715"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a421628840dc807f1f0c2265c763176ed">  715</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a421628840dc807f1f0c2265c763176ed">convert</a>(std::vector&lt;double&gt;&amp; out,</div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;                      <span class="keyword">const</span> std::vector&lt;cx_double&gt;&amp; in)</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;  {</div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;    <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(out, <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in));</div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in); i++)</div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;      out[i] = in[i].real();</div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;  }</div>
<div class="line"><a name="l00722"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#aa4cd5c3c53cd6bd535e37ba2c4db4bd7">  722</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aa4cd5c3c53cd6bd535e37ba2c4db4bd7">convert</a>(std::vector&lt;cx_double&gt;&amp; out, <span class="keyword">const</span> std::vector&lt;long&gt;&amp; in)</div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;  {</div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;    <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(out, <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in));</div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in); i++)</div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160;      out[i] = in[i];</div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;  }</div>
<div class="line"><a name="l00728"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a13112446e3d1596d974b51c3d1da8ba7">  728</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a13112446e3d1596d974b51c3d1da8ba7">convert</a>(std::vector&lt;long&gt;&amp; out, <span class="keyword">const</span> std::vector&lt;cx_double&gt;&amp; in)</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;  {</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;    <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(out, <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in));</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(in); i++)</div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;      out[i] = std::round(in[i].real());</div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;  }</div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160; </div>
<div class="line"><a name="l00735"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a407bacde3fcafde4071f6e6e37bc2771">  735</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array_base.html">EncryptedArrayBase</a>* <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a407bacde3fcafde4071f6e6e37bc2771">clone</a>()<span class="keyword"> const override</span></div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a759888cad7e21adc991832246d9ca3a2">EncryptedArrayCx</a>(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;  }</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160; </div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;  <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a9d770aef7c5a653d705f29a359187578">getiEncoded</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00741"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a42dae93ce85090806f840ad3bc5ef069">  741</a></span>&#160;  <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7e">PA_tag</a> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a42dae93ce85090806f840ad3bc5ef069">getTag</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee">PA_cx_tag</a>; }</div>
<div class="line"><a name="l00742"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">  742</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">getContext</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> context; }</div>
<div class="line"><a name="l00743"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a9e77914e54d3c5cf96370fafd1792d51">  743</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra.html">PAlgebra</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a9e77914e54d3c5cf96370fafd1792d51">getPAlgebra</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> alMod.<a class="code" href="classhelib_1_1_p_algebra_mod_cx.html#a5d2fd3234ccb5a63dd2a22d5e6dfcca0">getZMStar</a>(); }</div>
<div class="line"><a name="l00744"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#adb3be49bb5b91e3f7cca75c89877687f">  744</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#adb3be49bb5b91e3f7cca75c89877687f">getDegree</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> 2L; }</div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160; </div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a7d8d25cd71e1ca0bd7a287b18965d7c4">rotate</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a5e06f07495e1753090a36084f0567c24">shift</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a6f262de0581bb42862bfd5edbdc1b79d">rotate1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k, <span class="keywordtype">bool</span> dc = <span class="keyword">false</span>) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8c9c54b75a6f13a32c5c71157477d6a4">shift1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160; </div>
<div class="line"><a name="l00751"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a3df75f4c6f7d6962041e01f608fd168d">  751</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a3df75f4c6f7d6962041e01f608fd168d">getP2R</a>()<span class="keyword"> const override </span>{ <span class="keywordflow">return</span> alMod.<a class="code" href="classhelib_1_1_p_algebra_mod_cx.html#ad6761a53cc4fe80e280958782b18f31e">getPPowR</a>(); }</div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160; </div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;  <span class="comment">/* Begin BGV functions. They will simply throw here. */</span></div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;  <span class="comment">// encode</span></div>
<div class="line"><a name="l00761"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">  761</a></span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;  }</div>
<div class="line"><a name="l00772"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a6c3a912cab33e23d959d45826a398578">  772</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a6c3a912cab33e23d959d45826a398578">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;  }</div>
<div class="line"><a name="l00783"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ae5ce92c28f92efd122a6f93fed3c42a7">  783</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae5ce92c28f92efd122a6f93fed3c42a7">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> std::vector&lt;zzX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;  }</div>
<div class="line"><a name="l00794"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#aca004382bb4e4226ba45634f4302d8c0">  794</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aca004382bb4e4226ba45634f4302d8c0">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;  }</div>
<div class="line"><a name="l00805"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a4e916710a3d770b1a5e258c27ba2ef86">  805</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4e916710a3d770b1a5e258c27ba2ef86">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;  }</div>
<div class="line"><a name="l00816"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ab921e7d1e4408b40e64880ed71c079df">  816</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ab921e7d1e4408b40e64880ed71c079df">encode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::encode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;  }</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160; </div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;  <span class="comment">// decode</span></div>
<div class="line"><a name="l00829"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">  829</a></span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">decode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;long&gt;&amp; array,</div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;  }</div>
<div class="line"><a name="l00840"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a37f5f723bf309bf9727d301ba0c9e915">  840</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a37f5f723bf309bf9727d301ba0c9e915">decode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;NTL::ZZX&gt;&amp; array,</div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;  }</div>
<div class="line"><a name="l00851"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#adafe0d6e2cc46d72ed92629568260913">  851</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#adafe0d6e2cc46d72ed92629568260913">decode</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; array,</div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;              <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> NTL::ZZX&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;  }</div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160; </div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;  <span class="comment">// random</span></div>
<div class="line"><a name="l00863"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">  863</a></span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">random</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;NTL::ZZX&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decode for BGV type&quot;</span>);</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;  }</div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160; </div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;  <span class="comment">// decrypt</span></div>
<div class="line"><a name="l00876"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">  876</a></span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">decrypt</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;long&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decrypt for BGV type&quot;</span>);</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;  }</div>
<div class="line"><a name="l00889"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a7c7e7d86e4cc50878cd108efc4e97c46">  889</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a7c7e7d86e4cc50878cd108efc4e97c46">decrypt</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;NTL::ZZX&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decrypt for BGV type&quot;</span>);</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;  }</div>
<div class="line"><a name="l00902"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a7b2d7b9513ab362cc501444c80caf1b9">  902</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a7b2d7b9513ab362cc501444c80caf1b9">decrypt</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;               <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: EncryptedArrayCx::decrypt for BGV type&quot;</span>);</div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;  }</div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160; </div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;  <span class="comment">// buildLinPolyCoeffs</span></div>
<div class="line"><a name="l00916"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a8b7e8a98d581d65ed294d0d9e6d8b6c6">  916</a></span>&#160;<span class="comment"></span>  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8b7e8a98d581d65ed294d0d9e6d8b6c6">buildLinPolyCoeffs</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> std::vector&lt;NTL::ZZX&gt;&amp; C,</div>
<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160;                          <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; L)<span class="keyword"> const override</span></div>
<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unimplemented: &quot;</span></div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;                     <span class="stringliteral">&quot;EncryptedArrayCx::buildLinPolyCoeffs for BGV type&quot;</span>);</div>
<div class="line"><a name="l00921"></a><span class="lineno">  921</span>&#160;  }</div>
<div class="line"><a name="l00922"></a><span class="lineno">  922</span>&#160;  <span class="comment">/* End BGV functions. */</span></div>
<div class="line"><a name="l00923"></a><span class="lineno">  923</span>&#160; </div>
<div class="line"><a name="l00924"></a><span class="lineno">  924</span>&#160;  <span class="comment">// These EaCx-specific encoding routines return the</span></div>
<div class="line"><a name="l00925"></a><span class="lineno">  925</span>&#160;  <span class="comment">// scaling factor that was used in the encoding routine</span></div>
<div class="line"><a name="l00926"></a><span class="lineno">  926</span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00927"></a><span class="lineno">  927</span>&#160;                <span class="keyword">const</span> std::vector&lt;cx_double&gt;&amp; array,</div>
<div class="line"><a name="l00928"></a><span class="lineno">  928</span>&#160;                <span class="keywordtype">double</span> useThisSize,</div>
<div class="line"><a name="l00929"></a><span class="lineno">  929</span>&#160;                <span class="keywordtype">long</span> precision = -1) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00930"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a1192b25b1874ce96ccba61901f25b1d2">  930</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1192b25b1874ce96ccba61901f25b1d2">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00931"></a><span class="lineno">  931</span>&#160;                <span class="keyword">const</span> std::vector&lt;double&gt;&amp; array,</div>
<div class="line"><a name="l00932"></a><span class="lineno">  932</span>&#160;                <span class="keywordtype">double</span> useThisSize,</div>
<div class="line"><a name="l00933"></a><span class="lineno">  933</span>&#160;                <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l00934"></a><span class="lineno">  934</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00935"></a><span class="lineno">  935</span>&#160;    std::vector&lt;cx_double&gt; tmp;</div>
<div class="line"><a name="l00936"></a><span class="lineno">  936</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(tmp, array);</div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(ptxt, tmp, useThisSize, precision);</div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;  }</div>
<div class="line"><a name="l00939"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a8367c993fd304e5633ec0af3942d9dde">  939</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8367c993fd304e5633ec0af3942d9dde">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;                <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array,</div>
<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160;                <span class="keywordtype">double</span> useThisSize,</div>
<div class="line"><a name="l00942"></a><span class="lineno">  942</span>&#160;                <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00944"></a><span class="lineno">  944</span>&#160;    std::vector&lt;cx_double&gt; tmp;</div>
<div class="line"><a name="l00945"></a><span class="lineno">  945</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(tmp, array);</div>
<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(ptxt, tmp, useThisSize, precision);</div>
<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;  }</div>
<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160; </div>
<div class="line"><a name="l00958"></a><span class="lineno">  958</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l00959"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a4c41f5c4c4efad7ab4f395c476ad86a3">  959</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4c41f5c4c4efad7ab4f395c476ad86a3">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; out,</div>
<div class="line"><a name="l00960"></a><span class="lineno">  960</span>&#160;                <span class="keyword">const</span> <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; ptxt,</div>
<div class="line"><a name="l00961"></a><span class="lineno">  961</span>&#160;                <span class="keywordtype">double</span> useThisSize,</div>
<div class="line"><a name="l00962"></a><span class="lineno">  962</span>&#160;                <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l00963"></a><span class="lineno">  963</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00964"></a><span class="lineno">  964</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(out, ptxt.<a class="code" href="classhelib_1_1_ptxt.html#a9079d2c55de7a19af137da3d042c50d4">getSlotRepr</a>(), useThisSize, precision);</div>
<div class="line"><a name="l00965"></a><span class="lineno">  965</span>&#160;  }</div>
<div class="line"><a name="l00966"></a><span class="lineno">  966</span>&#160; </div>
<div class="line"><a name="l00967"></a><span class="lineno">  967</span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l00968"></a><span class="lineno">  968</span>&#160;                <span class="keywordtype">double</span> aSingleNumber,</div>
<div class="line"><a name="l00969"></a><span class="lineno">  969</span>&#160;                <span class="keywordtype">double</span> useThisSize = -1,</div>
<div class="line"><a name="l00970"></a><span class="lineno">  970</span>&#160;                <span class="keywordtype">long</span> precision = -1) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00971"></a><span class="lineno">  971</span>&#160; </div>
<div class="line"><a name="l00972"></a><span class="lineno">  972</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT&gt;</div>
<div class="line"><a name="l00973"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a194b09c3ca3c9880f587f598cdaab92c">  973</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a194b09c3ca3c9880f587f598cdaab92c">encode</a>(NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;                <span class="keyword">const</span> PTXT&amp; pt,</div>
<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;                <span class="keywordtype">double</span> useThisSize = -1,</div>
<div class="line"><a name="l00976"></a><span class="lineno">  976</span>&#160;                <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l00977"></a><span class="lineno">  977</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00978"></a><span class="lineno">  978</span>&#160;    <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> tmp;</div>
<div class="line"><a name="l00979"></a><span class="lineno">  979</span>&#160;    <span class="keywordtype">double</span> f = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(tmp, pt, useThisSize, precision);</div>
<div class="line"><a name="l00980"></a><span class="lineno">  980</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">::helib::convert</a>(ptxt, tmp);</div>
<div class="line"><a name="l00981"></a><span class="lineno">  981</span>&#160;    <span class="keywordflow">return</span> f;</div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;  }</div>
<div class="line"><a name="l00983"></a><span class="lineno">  983</span>&#160; </div>
<div class="line"><a name="l00984"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a9d95edb864185a146f2536a94b9eff80">  984</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a9d95edb864185a146f2536a94b9eff80">encryptOneNum</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;                     <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; key,</div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;                     <span class="keywordtype">double</span> num,</div>
<div class="line"><a name="l00987"></a><span class="lineno">  987</span>&#160;                     <span class="keywordtype">double</span> useThisSize = -1,</div>
<div class="line"><a name="l00988"></a><span class="lineno">  988</span>&#160;                     <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l00989"></a><span class="lineno">  989</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00990"></a><span class="lineno">  990</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;<a class="code" href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">getContext</a>(),</div>
<div class="line"><a name="l00991"></a><span class="lineno">  991</span>&#160;             &amp;ctxt.<a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>(),</div>
<div class="line"><a name="l00992"></a><span class="lineno">  992</span>&#160;             <span class="stringliteral">&quot;Cannot decrypt when ciphertext has different context than &quot;</span></div>
<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;             <span class="stringliteral">&quot;EncryptedArray&quot;</span>);</div>
<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;    <span class="keywordflow">if</span> (useThisSize &lt;= 0.0)</div>
<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160;      useThisSize = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a84a23e382804d2ed776dd7eebe65c41e">roundedSize</a>(num); <span class="comment">// rounded to power of two</span></div>
<div class="line"><a name="l00996"></a><span class="lineno">  996</span>&#160;    <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> pp;                           <span class="comment">// Convert num into a plaintext polynomial</span></div>
<div class="line"><a name="l00997"></a><span class="lineno">  997</span>&#160;    <span class="keywordtype">double</span> f = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(pp, num, useThisSize, precision);</div>
<div class="line"><a name="l00998"></a><span class="lineno">  998</span>&#160; </div>
<div class="line"><a name="l00999"></a><span class="lineno">  999</span>&#160;    key.<a class="code" href="classhelib_1_1_pub_key.html#aafbfc62d5d78c39aa7929d552b31ff03">CKKSencrypt</a>(ctxt, pp, useThisSize, f); <span class="comment">// encrypt resulting polynomial</span></div>
<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>&#160;  }</div>
<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>&#160; </div>
<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT&gt;</div>
<div class="line"><a name="l01003"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a3ace019165a5f26bc7fa0a2528324a15"> 1003</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a3ace019165a5f26bc7fa0a2528324a15">encrypt</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>&#160;               <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; key,</div>
<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>&#160;               <span class="keyword">const</span> PTXT&amp; ptxt,</div>
<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>&#160;               <span class="keywordtype">double</span> useThisSize,</div>
<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>&#160;               <span class="keywordtype">long</span> precision = -1)<span class="keyword"> const</span></div>
<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;<a class="code" href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">getContext</a>(),</div>
<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>&#160;             &amp;ctxt.<a class="code" href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">getContext</a>(),</div>
<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>&#160;             <span class="stringliteral">&quot;Cannot decrypt when ciphertext has different context than &quot;</span></div>
<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>&#160;             <span class="stringliteral">&quot;EncryptedArray&quot;</span>);</div>
<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>&#160;    <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> pp;</div>
<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>&#160;    <span class="keywordtype">double</span> f = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(pp, ptxt, useThisSize, precision);</div>
<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>&#160;    <span class="comment">// Convert into a polynomial</span></div>
<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>&#160;    key.<a class="code" href="classhelib_1_1_pub_key.html#aafbfc62d5d78c39aa7929d552b31ff03">CKKSencrypt</a>(ctxt, pp, useThisSize, f); <span class="comment">// encrypt the polynomial</span></div>
<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>&#160;  }</div>
<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>&#160; </div>
<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT&gt;</div>
<div class="line"><a name="l01020"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a79a4eb688187ecd60d37dd7c0b9e43a5"> 1020</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a79a4eb688187ecd60d37dd7c0b9e43a5">encrypt</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; key, <span class="keyword">const</span> PTXT&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a3ace019165a5f26bc7fa0a2528324a15">encrypt</a>(ctxt, key, ptxt, -1.0, -1);</div>
<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>&#160;  }</div>
<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>&#160; </div>
<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>&#160;  <span class="comment">// The methods below override EncryptedArrayBase, they use</span></div>
<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>&#160;  <span class="comment">// the default size=0 and precision=0, which yield size=1</span></div>
<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>&#160;  <span class="comment">// and precision=2^{-alMod.getR()-1}</span></div>
<div class="line"><a name="l01028"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a0fee8bb20e092b4728f2ed11c78bacc8"> 1028</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a0fee8bb20e092b4728f2ed11c78bacc8">encodeUnitSelector</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">long</span> i)<span class="keyword"> const override</span></div>
<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>&#160;    std::vector&lt;cx_double&gt; v(this-&gt;<a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>(), <a class="code" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">cx_double</a>(0.0));</div>
<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>&#160;    v.at(i) = <a class="code" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">cx_double</a>(1.0, 0.0);</div>
<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">encode</a>(ptxt, v, <span class="comment">/*size=*/</span>1.0, <span class="comment">/*default precision*/</span> -1);</div>
<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>&#160;  } <span class="comment">// The implicit scaling factor is encodeScalingFactor() below</span></div>
<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>&#160; </div>
<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>&#160;  <span class="comment">// A bound on the rounding error for encoding</span></div>
<div class="line"><a name="l01036"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a614df6336a69dd08830bebfcfb34a5a8"> 1036</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a614df6336a69dd08830bebfcfb34a5a8">encodeRoundingError</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;    <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">getContext</a>();</div>
<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160;    <span class="keywordtype">long</span> m = context.<a class="code" href="classhelib_1_1_context.html#ab261446cf0a635a7bf1edf081df48d81">zMStar</a>.<a class="code" href="classhelib_1_1_p_algebra.html#a6852047dd695a0b1ae1a5ea03c3b2c53">getM</a>();</div>
<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>&#160;    <span class="keywordflow">return</span> context.<a class="code" href="classhelib_1_1_context.html#ab79e1f941d6043131a14404c68bf538c">noiseBoundForUniform</a>(0.5, m);</div>
<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>&#160;  }</div>
<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>&#160;  <span class="comment">// The scaling factor to use when encoding/decoding plaintext elements</span></div>
<div class="line"><a name="l01043"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ab484dcb060abf64753a886c7bf734cd3"> 1043</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ab484dcb060abf64753a886c7bf734cd3">encodeScalingFactor</a>(<span class="keywordtype">long</span> precision = -1, <span class="keywordtype">double</span> roundErr = -1.0)<span class="keyword"> const</span></div>
<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>&#160;    assertTrue&lt;InvalidArgument&gt;(precision &lt; NTL_SP_BOUND,</div>
<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>&#160;                                <span class="stringliteral">&quot;Precision exceeds max single precision bound&quot;</span>);</div>
<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>&#160;    <span class="keywordflow">if</span> (precision &lt;= 0)</div>
<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>&#160;      precision = (1L &lt;&lt; alMod.<a class="code" href="classhelib_1_1_p_algebra_mod_cx.html#a9df1389f699003bf1579b22efb4cc546">getR</a>());</div>
<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>&#160;    <span class="keywordflow">if</span> (roundErr &lt; 0)</div>
<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>&#160;      roundErr = <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a614df6336a69dd08830bebfcfb34a5a8">encodeRoundingError</a>();</div>
<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>&#160;    <span class="keywordtype">long</span> f = ceil(precision * roundErr);</div>
<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>&#160;    <span class="comment">// We round the factor up to the next power of two</span></div>
<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>&#160;    <span class="keywordflow">return</span> (1L &lt;&lt; NTL::NextPowerOfTwo(f));</div>
<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>&#160;  }</div>
<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>&#160; </div>
<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">decode</a>(std::vector&lt;cx_double&gt;&amp; array,</div>
<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;              <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt,</div>
<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>&#160;              <span class="keywordtype">double</span> scaling) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>&#160; </div>
<div class="line"><a name="l01060"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#aee03f28f6d616e8109966f711c299f47"> 1060</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aee03f28f6d616e8109966f711c299f47">decode</a>(std::vector&lt;cx_double&gt;&amp; array,</div>
<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>&#160;              <span class="keyword">const</span> NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>&#160;              <span class="keywordtype">double</span> scaling)<span class="keyword"> const</span></div>
<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>&#160;    <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a> tmp;</div>
<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">::helib::convert</a>(tmp, ptxt);</div>
<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">decode</a>(array, tmp, scaling);</div>
<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>&#160;  }</div>
<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>&#160; </div>
<div class="line"><a name="l01069"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#af6adfaf69bf5ce786122da95a4c2bf9e"> 1069</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#af6adfaf69bf5ce786122da95a4c2bf9e">decode</a>(std::vector&lt;double&gt;&amp; array, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">double</span> scaling)<span class="keyword"> const</span></div>
<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;    std::vector&lt;cx_double&gt; v;</div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">decode</a>(v, ptxt, scaling);</div>
<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(array, v);</div>
<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>&#160;  }</div>
<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>&#160; </div>
<div class="line"><a name="l01076"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#ac0897608adff0c1e2e558968cbe96a3d"> 1076</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ac0897608adff0c1e2e558968cbe96a3d">decode</a>(std::vector&lt;double&gt;&amp; array,</div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;              <span class="keyword">const</span> NTL::ZZX&amp; ptxt,</div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;              <span class="keywordtype">double</span> scaling)<span class="keyword"> const</span></div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;    std::vector&lt;cx_double&gt; v;</div>
<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">decode</a>(v, ptxt, scaling);</div>
<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(array, v);</div>
<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>&#160;  }</div>
<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160; </div>
<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">random</a>(std::vector&lt;cx_double&gt;&amp; array, <span class="keywordtype">double</span> rad = 1.0) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01086"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a2bb0704f701023769bb7cc985fd18e73"> 1086</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a2bb0704f701023769bb7cc985fd18e73">random</a>(std::vector&lt;double&gt;&amp; array, <span class="keywordtype">double</span> rad = 1.0)<span class="keyword"> const</span></div>
<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>&#160;    std::vector&lt;cx_double&gt; v;</div>
<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">random</a>(v, rad);</div>
<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(array, v);</div>
<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>&#160;  }</div>
<div class="line"><a name="l01092"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a852eac6fa3232bbc05e850759334580a"> 1092</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a852eac6fa3232bbc05e850759334580a">random</a>(std::vector&lt;long&gt;&amp; array)<span class="keyword"> const override</span></div>
<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>&#160;    std::vector&lt;cx_double&gt; v;</div>
<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">random</a>(v, 1.0);</div>
<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(array, v);</div>
<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>&#160;  }</div>
<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>&#160; </div>
<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>&#160;               <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>&#160;               std::vector&lt;cx_double&gt;&amp; ptxt) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l01102"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a5bea11d6a177b18c3085e37fa5af5c20"> 1102</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a5bea11d6a177b18c3085e37fa5af5c20">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>&#160;               <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>&#160;               std::vector&lt;double&gt;&amp; ptxt)<span class="keyword"> const override</span></div>
<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>&#160;    std::vector&lt;cx_double&gt; v;</div>
<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">decrypt</a>(ctxt, sKey, v);</div>
<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">convert</a>(ptxt, v);</div>
<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>&#160;  }</div>
<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>&#160; </div>
<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l01121"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#afa9e2e8c44f575c2f47c6151c71cf8c5"> 1121</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#afa9e2e8c44f575c2f47c6151c71cf8c5">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>&#160;    std::vector&lt;cx_double&gt; ptxtArray;</div>
<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>&#160;    <a class="code" href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">decrypt</a>(ctxt, sKey, ptxtArray);</div>
<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>&#160;    ptxt.<a class="code" href="classhelib_1_1_ptxt.html#a1ac29a900263dbba14e9a48e651b9159">setData</a>(std::move(ptxtArray));</div>
<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>&#160;  }</div>
<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>&#160; </div>
<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a5c2c2a01e6ea6c972904c1e98738fbd1">extractRealPart</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>&#160; </div>
<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l01136"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#a333b490a6f284b78172e0e62092ea603"> 1136</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a333b490a6f284b78172e0e62092ea603">extractRealPart</a>(<a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; p)<span class="keyword"> const</span></div>
<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>&#160;    p = p.<a class="code" href="classhelib_1_1_ptxt.html#ae1a0c1d39f2077bede420a150d459e1d">real</a>();</div>
<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>&#160;  }</div>
<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>&#160; </div>
<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l01147"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array_cx.html#aeae260ec0a6f65f82abdfd25a875e0a3"> 1147</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aeae260ec0a6f65f82abdfd25a875e0a3">extractImPart</a>(<a class="code" href="classhelib_1_1_ptxt.html">Ptxt&lt;Scheme&gt;</a>&amp; p)<span class="keyword"> const</span></div>
<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>&#160;    p = p.<a class="code" href="classhelib_1_1_ptxt.html#ace682ff41a5f1833ae298aa8d33e05d5">imag</a>();</div>
<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>&#160;  }</div>
<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>&#160; </div>
<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aeae260ec0a6f65f82abdfd25a875e0a3">extractImPart</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c, <a class="code" href="classhelib_1_1_double_c_r_t.html">DoubleCRT</a>* dcrt = <span class="keyword">nullptr</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>&#160; </div>
<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>&#160; </div>
<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8b7e8a98d581d65ed294d0d9e6d8b6c6">buildLinPolyCoeffs</a>(std::vector&lt;zzX&gt;&amp; C,</div>
<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>&#160;                          <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">cx_double</a>&amp; oneImage,</div>
<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>&#160;                          <span class="keyword">const</span> <a class="code" href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">cx_double</a>&amp; iImage,</div>
<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>&#160;                          <span class="keywordtype">long</span> precision = 0) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>&#160; </div>
<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#a8b7e8a98d581d65ed294d0d9e6d8b6c6">buildLinPolyCoeffs</a>(std::vector&lt;zzX&gt;&amp; C,</div>
<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>&#160;                          <span class="keyword">const</span> std::vector&lt;cx_double&gt;&amp; oneImages,</div>
<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>&#160;                          <span class="keyword">const</span> std::vector&lt;cx_double&gt;&amp; iImages,</div>
<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>&#160;                          <span class="keywordtype">long</span> precision = 0) <span class="keyword">const</span>;</div>
<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>&#160; </div>
<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html#aee83a1b81625a43d1d819e3740b2a3b4">badDimensionAutomorphCorrection</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt,</div>
<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>&#160;                                       <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>&#160;                                       <span class="keywordtype">long</span> k) <span class="keyword">const override</span>;</div>
<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>&#160;};</div>
<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>&#160; </div>
<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>&#160;<span class="comment">// plaintextAutomorph: Compute b(X) = a(X^k) mod Phi_m(X).</span></div>
<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> RX, <span class="keyword">typename</span> RXModulus&gt;</div>
<div class="line"><a name="l01188"></a><span class="lineno"><a class="line" href="namespacehelib.html#aefd5d1a56f7036cae390706fe49e8fcb"> 1188</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aefd5d1a56f7036cae390706fe49e8fcb">plaintextAutomorph</a>(RX&amp; bb,</div>
<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>&#160;                        <span class="keyword">const</span> RX&amp; a,</div>
<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>&#160;                        <span class="keywordtype">long</span> k,</div>
<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>&#160;                        <span class="keywordtype">long</span> m,</div>
<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>&#160;                        <span class="keyword">const</span> RXModulus&amp; PhimX)</div>
<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>&#160;{</div>
<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>&#160;  <span class="comment">// compute b(X) = a(X^k) mod (X^m-1)</span></div>
<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>&#160;  <span class="keywordflow">if</span> (k == 1 || deg(a) &lt;= 0) {</div>
<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>&#160;    bb = a;</div>
<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>&#160;  }</div>
<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>&#160; </div>
<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>&#160;  RX b;</div>
<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>&#160;  b.SetLength(m);</div>
<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>&#160;  NTL::mulmod_precon_t precon = NTL::PrepMulModPrecon(k, m);</div>
<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> j = 0; j &lt;= deg(a); j++)</div>
<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>&#160;    b[NTL::MulModPrecon(j, k, m, precon)] = a[j]; <span class="comment">// b[j*k mod m] = a[j]</span></div>
<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>&#160;  b.normalize();</div>
<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>&#160; </div>
<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>&#160;  <a class="code" href="namespacehelib.html#af7b15d5fbf553550437df6ca02d5a282">rem</a>(bb, b, PhimX); <span class="comment">// reduce modulo the m&#39;th cyclotomic</span></div>
<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>&#160;}</div>
<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>&#160; </div>
<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>&#160;<span class="comment">// same as above, but k = g_i^j mod m.</span></div>
<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>&#160;<span class="comment">// also works with i == ea.getPalgebra().numOfGens(),</span></div>
<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>&#160;<span class="comment">// which means Frobenius</span></div>
<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>&#160; </div>
<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> RX, <span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01215"></a><span class="lineno"><a class="line" href="namespacehelib.html#a9f36286a4ff72a05ddf16c2e5bfaeba5"> 1215</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aefd5d1a56f7036cae390706fe49e8fcb">plaintextAutomorph</a>(RX&amp; b,</div>
<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>&#160;                        <span class="keyword">const</span> RX&amp; a,</div>
<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>&#160;                        <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>&#160;                        <span class="keywordtype">long</span> j,</div>
<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>&#160;                        <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;type&gt;</a>&amp; ea)</div>
<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>&#160;{</div>
<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra.html">PAlgebra</a>&amp; zMStar = ea.<a class="code" href="classhelib_1_1_encrypted_array_derived.html#aee12c18cec9f25f2e8b4208c7d32d1f7">getPAlgebra</a>();</div>
<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>&#160;  <span class="keyword">const</span> <span class="keyword">auto</span>&amp; F = ea.<a class="code" href="classhelib_1_1_encrypted_array_derived.html#a9741ce6601a5d07c83283beeff6cc7e0">getTab</a>().getPhimXMod();</div>
<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>&#160;  <span class="keywordtype">long</span> k = zMStar.<a class="code" href="classhelib_1_1_p_algebra.html#a1e1a00b24fd8cef132e213b1b0c290bc">genToPow</a>(i, j);</div>
<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>&#160;  <span class="keywordtype">long</span> m = zMStar.<a class="code" href="classhelib_1_1_p_algebra.html#a6852047dd695a0b1ae1a5ea03c3b2c53">getM</a>();</div>
<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>&#160;  <a class="code" href="namespacehelib.html#aefd5d1a56f7036cae390706fe49e8fcb">plaintextAutomorph</a>(b, a, k, m, F);</div>
<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>&#160;}</div>
<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>&#160; </div>
<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>&#160;EncryptedArrayBase* <a class="code" href="namespacehelib.html#acf194ed39fc9a3694d1a11a0cd4c75d4">buildEncryptedArray</a>(<span class="keyword">const</span> Context&amp; context,</div>
<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>&#160;                                        <span class="keyword">const</span> PAlgebraMod&amp; alMod,</div>
<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>&#160;                                        <span class="keyword">const</span> NTL::ZZX&amp; G = NTL::ZZX::zero());</div>
<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>&#160; </div>
<div class="line"><a name="l01236"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html"> 1236</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a></div>
<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>&#160;{</div>
<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod.html">PAlgebraMod</a>&amp; alMod;</div>
<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>&#160;  cloned_ptr&lt;EncryptedArrayBase&gt; rep;</div>
<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>&#160; </div>
<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l01244"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a4a83958f46369fac784b7fa6e4d6fa33"> 1244</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array.html#a4a83958f46369fac784b7fa6e4d6fa33">EncryptedArray</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context, <span class="keyword">const</span> NTL::ZZX&amp; G = NTL::ZZX(1, 1)) :</div>
<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>&#160;      alMod(context.alMod), rep(<a class="code" href="namespacehelib.html#acf194ed39fc9a3694d1a11a0cd4c75d4">buildEncryptedArray</a>(context, context.alMod, G))</div>
<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>&#160;  {}</div>
<div class="line"><a name="l01248"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a100aaeeedbaf9219fd000f912242a98b"> 1248</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array.html#a100aaeeedbaf9219fd000f912242a98b">EncryptedArray</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod.html">PAlgebraMod</a>&amp; _alMod) :</div>
<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>&#160;      alMod(_alMod), rep(<a class="code" href="namespacehelib.html#acf194ed39fc9a3694d1a11a0cd4c75d4">buildEncryptedArray</a>(context, _alMod))</div>
<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>&#160;  {}</div>
<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>&#160; </div>
<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>&#160;  <span class="comment">// copy constructor:</span></div>
<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>&#160; </div>
<div class="line"><a name="l01254"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ad5fc659aaaeeb403f21b3c5a951768ce"> 1254</a></span>&#160;  <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#ad5fc659aaaeeb403f21b3c5a951768ce">operator=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; other)</div>
<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>&#160;  {</div>
<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>&#160;    <span class="keywordflow">if</span> (<span class="keyword">this</span> == &amp;other)</div>
<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>&#160;      <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>&#160;    <a class="code" href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">assertEq</a>(&amp;alMod,</div>
<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>&#160;             &amp;other.alMod,</div>
<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>&#160;             <span class="stringliteral">&quot;Cannot assign EncryptedArrays with different algebras&quot;</span>);</div>
<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>&#160;    rep = other.rep;</div>
<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>&#160;  }</div>
<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>&#160; </div>
<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01269"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aa8d1a159d42064013aec1f949bb47327"> 1269</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;type&gt;</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#aa8d1a159d42064013aec1f949bb47327">getDerived</a>(type)<span class="keyword"> const</span></div>
<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;type&gt;</a>&amp;<span class="keyword">&gt;</span>(*rep);</div>
<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>&#160;  }</div>
<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>&#160; </div>
<div class="line"><a name="l01274"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a17703423ee9ce78df279ae701bcabdbd"> 1274</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_cx.html">EncryptedArrayCx</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#a17703423ee9ce78df279ae701bcabdbd">getCx</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classhelib_1_1_encrypted_array_cx.html">EncryptedArrayCx</a>&amp;<span class="keyword">&gt;</span>(*rep);</div>
<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>&#160;  }</div>
<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>&#160; </div>
<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>&#160; </div>
<div class="line"><a name="l01282"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a2e615f01bff3cd2a1f679e419343eeed"> 1282</a></span>&#160;  <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7e">PA_tag</a> <a class="code" href="classhelib_1_1_encrypted_array.html#a2e615f01bff3cd2a1f679e419343eeed">getTag</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;getTag(); }</div>
<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>&#160; </div>
<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">template</span> &lt;<span class="keyword">typename</span>&gt; <span class="keyword">class </span>T, <span class="keyword">typename</span>... Args&gt;</div>
<div class="line"><a name="l01285"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ab2662cc935cd36e0adc8eb52eb8546ee"> 1285</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#ab2662cc935cd36e0adc8eb52eb8546ee">dispatch</a>(Args&amp;&amp;... args)<span class="keyword"> const</span></div>
<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>&#160;    <span class="keywordflow">switch</span> (<a class="code" href="classhelib_1_1_encrypted_array.html#a2e615f01bff3cd2a1f679e419343eeed">getTag</a>()) {</div>
<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7eab33244c736f38a4c21e6d86c6a683d58">PA_GF2_tag</a>: {</div>
<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>&#160;      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;PA_GF2&gt;</a>* p =</div>
<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>&#160;          <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;PA_GF2&gt;</a>*<span class="keyword">&gt;</span>(rep.get_ptr());</div>
<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>&#160;      p-&gt;<a class="code" href="classhelib_1_1_encrypted_array_derived.html#a148c2b99586850a69ca19ab2b7fd562e">dispatch</a>&lt;T&gt;(std::forward&lt;Args&gt;(args)...);</div>
<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>&#160;    }</div>
<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>&#160;    <span class="keywordflow">case</span> <a class="code" href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea63d35380340004730e7cb505a4da38e2">PA_zz_p_tag</a>: {</div>
<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>&#160;      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;PA_zz_p&gt;</a>* p =</div>
<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>&#160;          <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;PA_zz_p&gt;</a>*<span class="keyword">&gt;</span>(rep.get_ptr());</div>
<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>&#160;      p-&gt;<a class="code" href="classhelib_1_1_encrypted_array_derived.html#a148c2b99586850a69ca19ab2b7fd562e">dispatch</a>&lt;T&gt;(std::forward&lt;Args&gt;(args)...);</div>
<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>&#160;    }</div>
<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>&#160;    <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>&#160;      <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(<span class="stringliteral">&quot;EncryptedArray: bad tag&quot;</span>);</div>
<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>&#160;    }</div>
<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>&#160;  }</div>
<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>&#160; </div>
<div class="line"><a name="l01305"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ada6929e7387f3fd6eb74ac762bbe1fcc"> 1305</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#ada6929e7387f3fd6eb74ac762bbe1fcc">getContext</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;getContext(); }</div>
<div class="line"><a name="l01306"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#acb9a52b2aae4f41b6ac4a1ababec282a"> 1306</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra_mod.html">PAlgebraMod</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#acb9a52b2aae4f41b6ac4a1ababec282a">getAlMod</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> alMod; }</div>
<div class="line"><a name="l01307"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aabf7802b8dbea7aede4c27daeb98166f"> 1307</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_p_algebra.html">PAlgebra</a>&amp; <a class="code" href="classhelib_1_1_encrypted_array.html#aabf7802b8dbea7aede4c27daeb98166f">getPAlgebra</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;getPAlgebra(); }</div>
<div class="line"><a name="l01308"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ac226637f8cf23a177ae75f5bbedd35e9"> 1308</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#ac226637f8cf23a177ae75f5bbedd35e9">getDegree</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;getDegree(); }</div>
<div class="line"><a name="l01309"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a0f887afd152534c4e5a698962b38565e"> 1309</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a0f887afd152534c4e5a698962b38565e">rotate</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k)<span class="keyword"> const </span>{ rep-&gt;rotate(ctxt, k); }</div>
<div class="line"><a name="l01310"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aa2d8dd041802b88703a472da3ad9150d"> 1310</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#aa2d8dd041802b88703a472da3ad9150d">shift</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> k)<span class="keyword"> const </span>{ rep-&gt;shift(ctxt, k); }</div>
<div class="line"><a name="l01311"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#af47cc08cfdfd71951986be4fe7f52816"> 1311</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#af47cc08cfdfd71951986be4fe7f52816">rotate1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k, <span class="keywordtype">bool</span> dc = <span class="keyword">false</span>)<span class="keyword"> const</span></div>
<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>&#160;    rep-&gt;rotate1D(ctxt, i, k, dc);</div>
<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>&#160;  }</div>
<div class="line"><a name="l01315"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#abdda60252affd27b27117b0b692db601"> 1315</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#abdda60252affd27b27117b0b692db601">shift1D</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k)<span class="keyword"> const </span>{ rep-&gt;shift1D(ctxt, i, k); }</div>
<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>&#160; </div>
<div class="line"><a name="l01317"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ab5f2dc888e3749fc056f07607718d40d"> 1317</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#ab5f2dc888e3749fc056f07607718d40d">badDimensionAutomorphCorrection</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keywordtype">long</span> i, <span class="keywordtype">long</span> amt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>&#160;    rep-&gt;badDimensionAutomorphCorrection(ctxt, i, amt);</div>
<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>&#160;  }</div>
<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>&#160; </div>
<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT, <span class="keyword">typename</span> ARRAY&gt;</div>
<div class="line"><a name="l01323"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aa3175ec1734ff04440b8df29ec4cf2f4"> 1323</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#aa3175ec1734ff04440b8df29ec4cf2f4">encode</a>(PTXT&amp; ptxt, <span class="keyword">const</span> ARRAY&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>&#160;    rep-&gt;encode(ptxt, array);</div>
<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>&#160;  }</div>
<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>&#160; </div>
<div class="line"><a name="l01328"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a1b802f329dd409388d9da48cd8218726"> 1328</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a1b802f329dd409388d9da48cd8218726">encodeUnitSelector</a>(<a class="code" href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">zzX</a>&amp; ptxt, <span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>&#160;    rep-&gt;encodeUnitSelector(ptxt, i);</div>
<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>&#160;  }</div>
<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>&#160; </div>
<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> PTXT, <span class="keyword">typename</span> ARRAY&gt;</div>
<div class="line"><a name="l01334"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a909d67c9c516ec5b4f99790f30068ff4"> 1334</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a909d67c9c516ec5b4f99790f30068ff4">decode</a>(ARRAY&amp; array, <span class="keyword">const</span> PTXT&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>&#160;    rep-&gt;decode(array, ptxt);</div>
<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>&#160;  }</div>
<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>&#160; </div>
<div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l01340"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a708feecf486157805b14f0856523be4d"> 1340</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a708feecf486157805b14f0856523be4d">random</a>(std::vector&lt;T&gt;&amp; array)<span class="keyword"> const</span></div>
<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>&#160;    rep-&gt;random(array);</div>
<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>&#160;  }</div>
<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>&#160; </div>
<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l01346"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a51692448b383260437f94880699ec0b8"> 1346</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a51692448b383260437f94880699ec0b8">encrypt</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_pub_key.html">PubKey</a>&amp; pKey, <span class="keyword">const</span> T&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01347"></a><span class="lineno"> 1347</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>&#160;    rep-&gt;encrypt(ctxt, pKey, ptxt);</div>
<div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>&#160;  }</div>
<div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>&#160; </div>
<div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l01352"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aa014f79a12bb1ca61a83ec3a1f43d858"> 1352</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#aa014f79a12bb1ca61a83ec3a1f43d858">decrypt</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, T&amp; ptxt)<span class="keyword"> const</span></div>
<div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>&#160;    rep-&gt;decrypt(ctxt, sKey, ptxt);</div>
<div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>&#160;  }</div>
<div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>&#160; </div>
<div class="line"><a name="l01357"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a91e0ea6381b603ca278ac1ca64b289f7"> 1357</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a91e0ea6381b603ca278ac1ca64b289f7">buildLinPolyCoeffs</a>(std::vector&lt;NTL::ZZX&gt;&amp; C,</div>
<div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>&#160;                          <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; L)<span class="keyword"> const</span></div>
<div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>&#160;    rep-&gt;buildLinPolyCoeffs(C, L);</div>
<div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>&#160;  }</div>
<div class="line"><a name="l01362"></a><span class="lineno"> 1362</span>&#160; </div>
<div class="line"><a name="l01363"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#ab7cb2f5fdc1c7d4f98e4b6cd7a1bf2fc"> 1363</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#ab7cb2f5fdc1c7d4f98e4b6cd7a1bf2fc">restoreContext</a>()<span class="keyword"> const </span>{ rep-&gt;restoreContext(); }</div>
<div class="line"><a name="l01364"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a41642d04c74633f6c1a4d23dbde50054"> 1364</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a41642d04c74633f6c1a4d23dbde50054">restoreContextForG</a>()<span class="keyword"> const </span>{ rep-&gt;restoreContextForG(); }</div>
<div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>&#160; </div>
<div class="line"><a name="l01366"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a9b9d09478922ab218c94de0f6477fda2"> 1366</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a9b9d09478922ab218c94de0f6477fda2">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;size(); }</div>
<div class="line"><a name="l01367"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#adc1452ff938cb0b4cf5f3d6aa335caaa"> 1367</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#adc1452ff938cb0b4cf5f3d6aa335caaa">dimension</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;dimension(); }</div>
<div class="line"><a name="l01368"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a23ded635ce06ba41ecbf30b801f67e8b"> 1368</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a23ded635ce06ba41ecbf30b801f67e8b">sizeOfDimension</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;sizeOfDimension(i); }</div>
<div class="line"><a name="l01369"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#af8c628cad17d0545363424a7b69cb21f"> 1369</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#af8c628cad17d0545363424a7b69cb21f">nativeDimension</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;nativeDimension(i); }</div>
<div class="line"><a name="l01370"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#aac8802bf761211269b152fe080301136"> 1370</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#aac8802bf761211269b152fe080301136">coordinate</a>(<span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rep-&gt;coordinate(i, k); }</div>
<div class="line"><a name="l01371"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a7bb033049827a4e517b512faefec9ec6"> 1371</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a7bb033049827a4e517b512faefec9ec6">addCoord</a>(<span class="keywordtype">long</span> i, <span class="keywordtype">long</span> k, <span class="keywordtype">long</span> offset)<span class="keyword"> const</span></div>
<div class="line"><a name="l01372"></a><span class="lineno"> 1372</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>&#160;    <span class="keywordflow">return</span> rep-&gt;addCoord(i, k, offset);</div>
<div class="line"><a name="l01374"></a><span class="lineno"> 1374</span>&#160;  }</div>
<div class="line"><a name="l01375"></a><span class="lineno"> 1375</span>&#160; </div>
<div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U&gt;</div>
<div class="line"><a name="l01379"></a><span class="lineno"><a class="line" href="classhelib_1_1_encrypted_array.html#a43affe53523fea549000a6c5a649a3d8"> 1379</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_encrypted_array.html#a43affe53523fea549000a6c5a649a3d8">rotate1D</a>(std::vector&lt;U&gt;&amp; out,</div>
<div class="line"><a name="l01380"></a><span class="lineno"> 1380</span>&#160;                <span class="keyword">const</span> std::vector&lt;U&gt;&amp; in,</div>
<div class="line"><a name="l01381"></a><span class="lineno"> 1381</span>&#160;                <span class="keywordtype">long</span> i,</div>
<div class="line"><a name="l01382"></a><span class="lineno"> 1382</span>&#160;                <span class="keywordtype">long</span> offset)<span class="keyword"> const</span></div>
<div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>&#160;    rep-&gt;rotate1D(out, in, i, offset);</div>
<div class="line"><a name="l01385"></a><span class="lineno"> 1385</span>&#160;  }</div>
<div class="line"><a name="l01387"></a><span class="lineno"> 1387</span>&#160;};</div>
<div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>&#160; </div>
<div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>&#160;<span class="comment">// NewPlaintextArray</span></div>
<div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>&#160; </div>
<div class="line"><a name="l01391"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_base.html"> 1391</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_plaintext_array_base.html">PlaintextArrayBase</a></div>
<div class="line"><a name="l01392"></a><span class="lineno"> 1392</span>&#160;{ <span class="comment">// purely abstract interface</span></div>
<div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l01394"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_base.html#a9255ca3ff65ca9e9c7f1a5ef5d24e80e"> 1394</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="classhelib_1_1_plaintext_array_base.html#a9255ca3ff65ca9e9c7f1a5ef5d24e80e">~PlaintextArrayBase</a>() {}</div>
<div class="line"><a name="l01395"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_base.html#a36bc0c395cf1f03648618c25cd2d9ccc"> 1395</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_plaintext_array_base.html#a36bc0c395cf1f03648618c25cd2d9ccc">print</a>(std::ostream&amp; s) <span class="keyword">const</span> = 0;</div>
<div class="line"><a name="l01396"></a><span class="lineno"> 1396</span>&#160;};</div>
<div class="line"><a name="l01397"></a><span class="lineno"> 1397</span>&#160; </div>
<div class="line"><a name="l01398"></a><span class="lineno"> 1398</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01399"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_derived.html"> 1399</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_plaintext_array_derived.html">PlaintextArrayDerived</a> : <span class="keyword">public</span> <a class="code" href="classhelib_1_1_plaintext_array_base.html">PlaintextArrayBase</a></div>
<div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>&#160;{</div>
<div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l01402"></a><span class="lineno"> 1402</span>&#160;  <a class="code" href="_p_algebra_8h.html#a3f121e88d1ede1fd384a8ad4ebb51f41">PA_INJECT</a>(type)</div>
<div class="line"><a name="l01403"></a><span class="lineno"> 1403</span>&#160; </div>
<div class="line"><a name="l01404"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_derived.html#a4853a06494cccb9b199c8570908b5d52"> 1404</a></span>&#160;  <a class="code" href="namespacestd.html">std</a>::vector&lt;RX&gt; <a class="code" href="classhelib_1_1_plaintext_array_derived.html#a4853a06494cccb9b199c8570908b5d52">data</a>;</div>
<div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>&#160; </div>
<div class="line"><a name="l01406"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array_derived.html#a2c3372b943c4e332dd32365457c0be58"> 1406</a></span>&#160;  virtual <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_plaintext_array_derived.html#a2c3372b943c4e332dd32365457c0be58">print</a>(<a class="code" href="namespacestd.html">std</a>::ostream&amp; s)<span class="keyword"> const </span>{ s &lt;&lt; <a class="code" href="classhelib_1_1_plaintext_array_derived.html#a4853a06494cccb9b199c8570908b5d52">data</a>; }</div>
<div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>&#160;};</div>
<div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>&#160; </div>
<div class="line"><a name="l01409"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html"> 1409</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a></div>
<div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>&#160;{</div>
<div class="line"><a name="l01411"></a><span class="lineno"> 1411</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l01412"></a><span class="lineno"> 1412</span>&#160;  NTL::CloneablePtr&lt;PlaintextArrayBase&gt; rep;</div>
<div class="line"><a name="l01413"></a><span class="lineno"> 1413</span>&#160; </div>
<div class="line"><a name="l01414"></a><span class="lineno"> 1414</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>&#160;  <span class="keyword">class </span>ConstructorImpl</div>
<div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>&#160;  {</div>
<div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>&#160;  <span class="keyword">public</span>:</div>
<div class="line"><a name="l01418"></a><span class="lineno"> 1418</span>&#160;    <a class="code" href="_p_algebra_8h.html#a3f121e88d1ede1fd384a8ad4ebb51f41">PA_INJECT</a>(type)</div>
<div class="line"><a name="l01419"></a><span class="lineno"> 1419</span>&#160; </div>
<div class="line"><a name="l01420"></a><span class="lineno"> 1420</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> apply(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array_derived.html">EncryptedArrayDerived&lt;type&gt;</a>&amp; ea, <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; pa)</div>
<div class="line"><a name="l01421"></a><span class="lineno"> 1421</span>&#160;    {</div>
<div class="line"><a name="l01422"></a><span class="lineno"> 1422</span>&#160;      NTL::CloneablePtr&lt;PlaintextArrayDerived&lt;type&gt;&gt; ptr =</div>
<div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>&#160;          NTL::MakeCloneable&lt;PlaintextArrayDerived&lt;type&gt;&gt;();</div>
<div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>&#160;      ptr-&gt;data.resize(ea.<a class="code" href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">size</a>());</div>
<div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>&#160;      pa.rep = ptr;</div>
<div class="line"><a name="l01426"></a><span class="lineno"> 1426</span>&#160;    }</div>
<div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>&#160;  };</div>
<div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>&#160; </div>
<div class="line"><a name="l01429"></a><span class="lineno"> 1429</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l01430"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#aee891154a87c72eb80d3ba309f3f3e54"> 1430</a></span>&#160;  <a class="code" href="classhelib_1_1_plaintext_array.html#aee891154a87c72eb80d3ba309f3f3e54">PlaintextArray</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; ea)</div>
<div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>&#160;  {</div>
<div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>&#160;    ea.<a class="code" href="classhelib_1_1_encrypted_array.html#ab2662cc935cd36e0adc8eb52eb8546ee">dispatch</a>&lt;ConstructorImpl&gt;(*this);</div>
<div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>&#160;  }</div>
<div class="line"><a name="l01434"></a><span class="lineno"> 1434</span>&#160; </div>
<div class="line"><a name="l01435"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#a277e318dc8908b0ce8f8734b978a093f"> 1435</a></span>&#160;  <a class="code" href="classhelib_1_1_plaintext_array.html#a277e318dc8908b0ce8f8734b978a093f">PlaintextArray</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; other) : rep(other.rep.clone()) {}</div>
<div class="line"><a name="l01436"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#a637857c499280edd1accf56c85d4cc77"> 1436</a></span>&#160;  <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; <a class="code" href="classhelib_1_1_plaintext_array.html#a637857c499280edd1accf56c85d4cc77">operator=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; other)</div>
<div class="line"><a name="l01437"></a><span class="lineno"> 1437</span>&#160;  {</div>
<div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>&#160;    rep = other.rep.clone();</div>
<div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l01440"></a><span class="lineno"> 1440</span>&#160;  }</div>
<div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>&#160; </div>
<div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01443"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#ad1e2806d7c7e67a9d637263eab776e9e"> 1443</a></span>&#160;  std::vector&lt;typename type::RX&gt;&amp; <a class="code" href="classhelib_1_1_plaintext_array.html#ad1e2806d7c7e67a9d637263eab776e9e">getData</a>()</div>
<div class="line"><a name="l01444"></a><span class="lineno"> 1444</span>&#160;  {</div>
<div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>&#160;    <span class="keywordflow">return</span> (<span class="keyword">dynamic_cast&lt;</span><a class="code" href="classhelib_1_1_plaintext_array_derived.html">PlaintextArrayDerived&lt;type&gt;</a>&amp;<span class="keyword">&gt;</span>(*rep)).data;</div>
<div class="line"><a name="l01446"></a><span class="lineno"> 1446</span>&#160;  }</div>
<div class="line"><a name="l01447"></a><span class="lineno"> 1447</span>&#160; </div>
<div class="line"><a name="l01448"></a><span class="lineno"> 1448</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> type&gt;</div>
<div class="line"><a name="l01449"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#a4b9fb9574b016009f20def5bd3952269"> 1449</a></span>&#160;  <span class="keyword">const</span> std::vector&lt;typename type::RX&gt;&amp; <a class="code" href="classhelib_1_1_plaintext_array.html#a4b9fb9574b016009f20def5bd3952269">getData</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l01450"></a><span class="lineno"> 1450</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l01451"></a><span class="lineno"> 1451</span>&#160;    <span class="keywordflow">return</span> (<span class="keyword">dynamic_cast&lt;</span><a class="code" href="classhelib_1_1_plaintext_array_derived.html">PlaintextArrayDerived&lt;type&gt;</a>&amp;<span class="keyword">&gt;</span>(*rep)).data;</div>
<div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>&#160;  }</div>
<div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>&#160; </div>
<div class="line"><a name="l01454"></a><span class="lineno"><a class="line" href="classhelib_1_1_plaintext_array.html#a80f94a3b909e8092520f5c263f66996d"> 1454</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_plaintext_array.html#a80f94a3b909e8092520f5c263f66996d">print</a>(std::ostream&amp; s)<span class="keyword"> const </span>{ rep-&gt;print(s); }</div>
<div class="line"><a name="l01455"></a><span class="lineno"> 1455</span>&#160;};</div>
<div class="line"><a name="l01456"></a><span class="lineno"> 1456</span>&#160; </div>
<div class="line"><a name="l01457"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae5cdfe4d2a5d750a2f2ae0f2d0addabc"> 1457</a></span>&#160;<span class="keyword">inline</span> std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_plaintext_array.html">PlaintextArray</a>&amp; pa)</div>
<div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>&#160;{</div>
<div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>&#160;  pa.<a class="code" href="classhelib_1_1_plaintext_array.html#a80f94a3b909e8092520f5c263f66996d">print</a>(s);</div>
<div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>&#160;  <span class="keywordflow">return</span> s;</div>
<div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>&#160;}</div>
<div class="line"><a name="l01462"></a><span class="lineno"> 1462</span>&#160; </div>
<div class="line"><a name="l01463"></a><span class="lineno"> 1463</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a34783d4707b52b8cb0341187d50f8265">rotate</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keywordtype">long</span> k);</div>
<div class="line"><a name="l01464"></a><span class="lineno"> 1464</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae2250fb1a88c915ce004837c63aa5ad7">shift</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keywordtype">long</span> k);</div>
<div class="line"><a name="l01465"></a><span class="lineno"> 1465</span>&#160; </div>
<div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acf08ccbcd03824fa3825640c1b171481">encode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>&#160;            PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01468"></a><span class="lineno"> 1468</span>&#160;            <span class="keyword">const</span> std::vector&lt;long&gt;&amp; array);</div>
<div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acf08ccbcd03824fa3825640c1b171481">encode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>&#160;            PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01471"></a><span class="lineno"> 1471</span>&#160;            <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; array);</div>
<div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acf08ccbcd03824fa3825640c1b171481">encode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keywordtype">long</span> val);</div>
<div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acf08ccbcd03824fa3825640c1b171481">encode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keyword">const</span> NTL::ZZX&amp; val);</div>
<div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>&#160; </div>
<div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a38c7c1b517a8ec41eacfc5c2dba6e293">random</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa);</div>
<div class="line"><a name="l01476"></a><span class="lineno"> 1476</span>&#160; </div>
<div class="line"><a name="l01477"></a><span class="lineno"> 1477</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7d7757fc124c051547f6d8d62f57e6ee">decode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01478"></a><span class="lineno"> 1478</span>&#160;            std::vector&lt;long&gt;&amp; array,</div>
<div class="line"><a name="l01479"></a><span class="lineno"> 1479</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; pa);</div>
<div class="line"><a name="l01480"></a><span class="lineno"> 1480</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7d7757fc124c051547f6d8d62f57e6ee">decode</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01481"></a><span class="lineno"> 1481</span>&#160;            std::vector&lt;NTL::ZZX&gt;&amp; array,</div>
<div class="line"><a name="l01482"></a><span class="lineno"> 1482</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; pa);</div>
<div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>&#160; </div>
<div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#aa271293d5f46187af89cc81ecb0235e9">equals</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01486"></a><span class="lineno"> 1486</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; other);</div>
<div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#aa271293d5f46187af89cc81ecb0235e9">equals</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>&#160;            <span class="keyword">const</span> std::vector&lt;long&gt;&amp; other);</div>
<div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#aa271293d5f46187af89cc81ecb0235e9">equals</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01491"></a><span class="lineno"> 1491</span>&#160;            <span class="keyword">const</span> PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01492"></a><span class="lineno"> 1492</span>&#160;            <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; other);</div>
<div class="line"><a name="l01493"></a><span class="lineno"> 1493</span>&#160; </div>
<div class="line"><a name="l01494"></a><span class="lineno"> 1494</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a42185bbb249368e34f515e09e90bc7b0">add</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>&#160;         PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>&#160;         <span class="keyword">const</span> PlaintextArray&amp; other);</div>
<div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a305064dc4866c160a571bd653556c113">sub</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01498"></a><span class="lineno"> 1498</span>&#160;         PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>&#160;         <span class="keyword">const</span> PlaintextArray&amp; other);</div>
<div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0cfe07d1b0c2f0e6385f2b6525e0a69b">mul</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01501"></a><span class="lineno"> 1501</span>&#160;         PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>&#160;         <span class="keyword">const</span> PlaintextArray&amp; other);</div>
<div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a2f6016d5e65b16abb1feba5a82067b14">negate</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa);</div>
<div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>&#160; </div>
<div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab08d6e1c47a1f0b8ed57aff211929548">frobeniusAutomorph</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keywordtype">long</span> j);</div>
<div class="line"><a name="l01506"></a><span class="lineno"> 1506</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab08d6e1c47a1f0b8ed57aff211929548">frobeniusAutomorph</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01507"></a><span class="lineno"> 1507</span>&#160;                        PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01508"></a><span class="lineno"> 1508</span>&#160;                        <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; vec);</div>
<div class="line"><a name="l01509"></a><span class="lineno"> 1509</span>&#160; </div>
<div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#adf575ea763b7454a6e8df566a9e64b3c">applyPerm</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>&#160;               PlaintextArray&amp; pa,</div>
<div class="line"><a name="l01512"></a><span class="lineno"> 1512</span>&#160;               <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; pi);</div>
<div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>&#160; </div>
<div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a83b1a8080de040baddd971b44488ca51">power</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, PlaintextArray&amp; pa, <span class="keywordtype">long</span> e);</div>
<div class="line"><a name="l01515"></a><span class="lineno"> 1515</span>&#160; </div>
<div class="line"><a name="l01516"></a><span class="lineno"> 1516</span>&#160;<span class="comment">// Following are functions for performing &quot;higher level&quot;</span></div>
<div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>&#160;<span class="comment">// operations on &quot;encrypted arrays&quot;.  There is really no</span></div>
<div class="line"><a name="l01518"></a><span class="lineno"> 1518</span>&#160;<span class="comment">// reason for these to be members of the EncryptedArray class,</span></div>
<div class="line"><a name="l01519"></a><span class="lineno"> 1519</span>&#160;<span class="comment">// so they are just declared as separate functions.</span></div>
<div class="line"><a name="l01520"></a><span class="lineno"> 1520</span>&#160; </div>
<div class="line"><a name="l01523"></a><span class="lineno"> 1523</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a55aba5934157b9d7517101534a0053a2">runningSums</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, Ctxt&amp; ctxt);</div>
<div class="line"><a name="l01524"></a><span class="lineno"> 1524</span>&#160;<span class="comment">// The implementation uses O(log n) shift operations.</span></div>
<div class="line"><a name="l01525"></a><span class="lineno"> 1525</span>&#160; </div>
<div class="line"><a name="l01528"></a><span class="lineno"> 1528</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#af72790276847439369c96063c3cdc803">totalSums</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, Ctxt&amp; ctxt);</div>
<div class="line"><a name="l01529"></a><span class="lineno"> 1529</span>&#160; </div>
<div class="line"><a name="l01532"></a><span class="lineno"> 1532</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a4d0fb010c5631535fe448caabc974860">mapTo01</a>(<span class="keyword">const</span> EncryptedArray&amp; ea, Ctxt&amp; ctxt);</div>
<div class="line"><a name="l01533"></a><span class="lineno"> 1533</span>&#160;<span class="comment">// Implemented in eqtesting.cpp. We compute</span></div>
<div class="line"><a name="l01534"></a><span class="lineno"> 1534</span>&#160;<span class="comment">//             x^{p^d-1} = x^{(1+p+...+p^{d-1})*(p-1)}</span></div>
<div class="line"><a name="l01535"></a><span class="lineno"> 1535</span>&#160;<span class="comment">// by setting y=x^{p-1} and then outputting y * y^p * ... * y^{p^{d-1}},</span></div>
<div class="line"><a name="l01536"></a><span class="lineno"> 1536</span>&#160;<span class="comment">// with exponentiation to powers of p done via Frobenius.</span></div>
<div class="line"><a name="l01537"></a><span class="lineno"> 1537</span>&#160; </div>
<div class="line"><a name="l01539"></a><span class="lineno"> 1539</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scheme&gt;</div>
<div class="line"><a name="l01540"></a><span class="lineno"> 1540</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a4d0fb010c5631535fe448caabc974860">mapTo01</a>(<span class="keyword">const</span> EncryptedArray&amp;, Ptxt&lt;Scheme&gt;&amp; ptxt);</div>
<div class="line"><a name="l01541"></a><span class="lineno"> 1541</span>&#160; </div>
<div class="line"><a name="l01546"></a><span class="lineno"> 1546</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab42c58780be6927575c8548d842f47b9">incrementalZeroTest</a>(Ctxt* res[],</div>
<div class="line"><a name="l01547"></a><span class="lineno"> 1547</span>&#160;                         <span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01548"></a><span class="lineno"> 1548</span>&#160;                         <span class="keyword">const</span> Ctxt&amp; ctxt,</div>
<div class="line"><a name="l01549"></a><span class="lineno"> 1549</span>&#160;                         <span class="keywordtype">long</span> n);</div>
<div class="line"><a name="l01550"></a><span class="lineno"> 1550</span>&#160;<span class="comment">// Complexity: O(d + n log d) smart automorphisms</span></div>
<div class="line"><a name="l01551"></a><span class="lineno"> 1551</span>&#160;<span class="comment">//             O(n d)</span></div>
<div class="line"><a name="l01552"></a><span class="lineno"> 1552</span>&#160; </div>
<div class="line"><a name="l01553"></a><span class="lineno"> 1553</span>&#160;<span class="comment">/*************** End linear transformation functions ****************/</span></div>
<div class="line"><a name="l01554"></a><span class="lineno"> 1554</span>&#160;<span class="comment">/********************************************************************/</span></div>
<div class="line"><a name="l01555"></a><span class="lineno"> 1555</span>&#160; </div>
<div class="line"><a name="l01557"></a><span class="lineno"> 1557</span>&#160; </div>
<div class="line"><a name="l01573"></a><span class="lineno"> 1573</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a583abeb8ab8021559fb519621b42c3d7">applyLinPoly1</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01576"></a><span class="lineno"> 1576</span>&#160;                   Ctxt&amp; ctxt,</div>
<div class="line"><a name="l01577"></a><span class="lineno"> 1577</span>&#160;                   <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; C);</div>
<div class="line"><a name="l01578"></a><span class="lineno"> 1578</span>&#160; </div>
<div class="line"><a name="l01582"></a><span class="lineno"> 1582</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aa8e520a1528ee0d150a9818c7ddc4850">applyLinPolyMany</a>(<span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l01583"></a><span class="lineno"> 1583</span>&#160;                      Ctxt&amp; ctxt,</div>
<div class="line"><a name="l01584"></a><span class="lineno"> 1584</span>&#160;                      <span class="keyword">const</span> std::vector&lt;std::vector&lt;NTL::ZZX&gt;&gt;&amp; Cvec);</div>
<div class="line"><a name="l01585"></a><span class="lineno"> 1585</span>&#160; </div>
<div class="line"><a name="l01589"></a><span class="lineno"> 1589</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> P&gt; <span class="comment">// P can be ZZX or DoubleCRT</span></div>
<div class="line"><a name="l01590"></a><span class="lineno"> 1590</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a21457a6ed2a6de2701b394bfcc90be1e">applyLinPolyLL</a>(Ctxt&amp; ctxt, <span class="keyword">const</span> std::vector&lt;P&gt;&amp; encodedC, <span class="keywordtype">long</span> d);</div>
<div class="line"><a name="l01592"></a><span class="lineno"> 1592</span>&#160; </div>
<div class="line"><a name="l01593"></a><span class="lineno"> 1593</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l01594"></a><span class="lineno"> 1594</span>&#160; </div>
<div class="line"><a name="l01595"></a><span class="lineno"> 1595</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_ENCRYPTEDARRAY_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_ptxt_html"><div class="ttname"><a href="classhelib_1_1_ptxt.html">helib::Ptxt</a></div><div class="ttdoc">An object that mimics the functionality of the Ctxt object, and acts as a convenient entry point for ...</div><div class="ttdef"><b>Definition:</b> Ctxt.h:66</div></div>
<div class="ttc" id="anamespacehelib_html_a34783d4707b52b8cb0341187d50f8265"><div class="ttname"><a href="namespacehelib.html#a34783d4707b52b8cb0341187d50f8265">helib::rotate</a></div><div class="ttdeci">void rotate(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, long k)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:763</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_ab01ff1a6b2a0eceba09d688a933de360"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#ab01ff1a6b2a0eceba09d688a933de360">helib::PAlgebra::OrderOf</a></div><div class="ttdeci">long OrderOf(long i) const</div><div class="ttdoc">The order of i'th generator (if any)</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:217</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_a17f72520454a241efefa48b9132faf47"><div class="ttname"><a href="classhelib_1_1_ctxt.html#a17f72520454a241efefa48b9132faf47">helib::Ctxt::getContext</a></div><div class="ttdeci">const Context &amp; getContext() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:764</div></div>
<div class="ttc" id="anamespacehelib_html_a0cfe07d1b0c2f0e6385f2b6525e0a69b"><div class="ttname"><a href="namespacehelib.html#a0cfe07d1b0c2f0e6385f2b6525e0a69b">helib::mul</a></div><div class="ttdeci">void mul(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1064</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_af47cc08cfdfd71951986be4fe7f52816"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#af47cc08cfdfd71951986be4fe7f52816">helib::EncryptedArray::rotate1D</a></div><div class="ttdeci">void rotate1D(Ctxt &amp;ctxt, long i, long k, bool dc=false) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1311</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_aacbeee1b5623eeec1d2c8ca311654cc7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#aacbeee1b5623eeec1d2c8ca311654cc7">helib::EncryptedArrayBase::decode</a></div><div class="ttdeci">virtual void decode(std::vector&lt; long &gt; &amp;array, const NTL::ZZX &amp;ptxt) const =0</div></div>
<div class="ttc" id="anamespacehelib_html_ae8f65ef133cee27ad846423d012d5487"><div class="ttname"><a href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">helib::lsize</a></div><div class="ttdeci">long lsize(const std::vector&lt; T &gt; &amp;v)</div><div class="ttdoc">Size of STL vector as a long (rather than unsigned long)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:652</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a9b9d09478922ab218c94de0f6477fda2"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a9b9d09478922ab218c94de0f6477fda2">helib::EncryptedArray::size</a></div><div class="ttdeci">long size() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1366</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a6c3a912cab33e23d959d45826a398578"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a6c3a912cab33e23d959d45826a398578">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED NTL::ZZX &amp;ptxt, UNUSED const std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:772</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a9e77914e54d3c5cf96370fafd1792d51"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a9e77914e54d3c5cf96370fafd1792d51">helib::EncryptedArrayCx::getPAlgebra</a></div><div class="ttdeci">const PAlgebra &amp; getPAlgebra() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:743</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a7bb033049827a4e517b512faefec9ec6"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a7bb033049827a4e517b512faefec9ec6">helib::EncryptedArray::addCoord</a></div><div class="ttdeci">long addCoord(long i, long k, long offset) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1371</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a6852047dd695a0b1ae1a5ea03c3b2c53"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a6852047dd695a0b1ae1a5ea03c3b2c53">helib::PAlgebra::getM</a></div><div class="ttdeci">long getM() const</div><div class="ttdoc">Returns m.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:162</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ab484dcb060abf64753a886c7bf734cd3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ab484dcb060abf64753a886c7bf734cd3">helib::EncryptedArrayCx::encodeScalingFactor</a></div><div class="ttdeci">long encodeScalingFactor(long precision=-1, double roundErr=-1.0) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1043</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a4c1ee4078df5f248d96b30dd5676783e"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a4c1ee4078df5f248d96b30dd5676783e">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(NTL::ZZX &amp;ptxt, const std::vector&lt; NTL::ZZX &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_runtime_error_html"><div class="ttname"><a href="classhelib_1_1_runtime_error.html">helib::RuntimeError</a></div><div class="ttdoc">Inherits from Exception and std::runtime_error.</div><div class="ttdef"><b>Definition:</b> exceptions.h:105</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ade59fa0a4bceb030a895d725ee1f7d88"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ade59fa0a4bceb030a895d725ee1f7d88">helib::EncryptedArrayBase::encrypt</a></div><div class="ttdeci">void encrypt(Ctxt &amp;ctxt, const PubKey &amp;key, const PTXT &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:209</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a708feecf486157805b14f0856523be4d"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a708feecf486157805b14f0856523be4d">helib::EncryptedArray::random</a></div><div class="ttdeci">void random(std::vector&lt; T &gt; &amp;array) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1340</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a3829a9890ce25a65bdb5111bf2bdd687"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a3829a9890ce25a65bdb5111bf2bdd687">helib::EncryptedArrayBase::restoreContext</a></div><div class="ttdeci">virtual void restoreContext() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:272</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a194b09c3ca3c9880f587f598cdaab92c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a194b09c3ca3c9880f587f598cdaab92c">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">double encode(NTL::ZZX &amp;ptxt, const PTXT &amp;pt, double useThisSize=-1, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:973</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a8b461cfa84f1751ad0db61a80ff5c7e8"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a8b461cfa84f1751ad0db61a80ff5c7e8">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(zzX &amp;ptxt, const PlaintextArray &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a5a90fd828a817490c390947228ecf928"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a5a90fd828a817490c390947228ecf928">helib::PAlgebra::getNSlots</a></div><div class="ttdeci">long getNSlots() const</div><div class="ttdoc">The number of plaintext slots = phi(m)/ord(p)</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:186</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a1192b25b1874ce96ccba61901f25b1d2"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a1192b25b1874ce96ccba61901f25b1d2">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">double encode(zzX &amp;ptxt, const std::vector&lt; double &gt; &amp;array, double useThisSize, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:930</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a17703423ee9ce78df279ae701bcabdbd"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a17703423ee9ce78df279ae701bcabdbd">helib::EncryptedArray::getCx</a></div><div class="ttdeci">const EncryptedArrayCx &amp; getCx() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1274</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a05e74964d2a8246b2c197251d6426faa"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a05e74964d2a8246b2c197251d6426faa">helib::EncryptedArrayBase::badDimensionAutomorphCorrection</a></div><div class="ttdeci">virtual void badDimensionAutomorphCorrection(Ctxt &amp;ctxt, long i, long amt) const =0</div><div class="ttdoc">Correct an automorphism in a bad dimension.</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_derived_html_a4853a06494cccb9b199c8570908b5d52"><div class="ttname"><a href="classhelib_1_1_plaintext_array_derived.html#a4853a06494cccb9b199c8570908b5d52">helib::PlaintextArrayDerived::data</a></div><div class="ttdeci">std::vector&lt; RX &gt; data</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1404</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ad307509bc693f875334cd67b84ba401d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ad307509bc693f875334cd67b84ba401d">helib::EncryptedArrayDerived::random</a></div><div class="ttdeci">void random(std::vector&lt; RX &gt; &amp;array) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:591</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a8b7e8a98d581d65ed294d0d9e6d8b6c6"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a8b7e8a98d581d65ed294d0d9e6d8b6c6">helib::EncryptedArrayCx::buildLinPolyCoeffs</a></div><div class="ttdeci">void buildLinPolyCoeffs(UNUSED std::vector&lt; NTL::ZZX &gt; &amp;C, UNUSED const std::vector&lt; NTL::ZZX &gt; &amp;L) const override</div><div class="ttdoc">Unimplemented buildLinPolyCoeffs function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:916</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ad3a288634f433757cb36f2cd76db1382"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ad3a288634f433757cb36f2cd76db1382">helib::EncryptedArrayCx::decrypt</a></div><div class="ttdeci">void decrypt(UNUSED const Ctxt &amp;ctxt, UNUSED const SecKey &amp;sKey, UNUSED std::vector&lt; long &gt; &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decrypt function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:876</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a80cc816a32404a8dc6e9a7ad28a2b810"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a80cc816a32404a8dc6e9a7ad28a2b810">helib::EncryptedArrayDerived::encode</a></div><div class="ttdeci">virtual void encode(NTL::ZZX &amp;ptxt, const std::vector&lt; NTL::ZZX &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:498</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_ad1e2806d7c7e67a9d637263eab776e9e"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#ad1e2806d7c7e67a9d637263eab776e9e">helib::PlaintextArray::getData</a></div><div class="ttdeci">std::vector&lt; typename type::RX &gt; &amp; getData()</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1443</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_derived_html_aa63328efb58148204ed8a95287be7c19"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_derived.html#aa63328efb58148204ed8a95287be7c19">helib::PAlgebraModDerived::getZMStar</a></div><div class="ttdeci">virtual const PAlgebra &amp; getZMStar() const override</div><div class="ttdoc">Returns reference to underlying PAlgebra object.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:610</div></div>
<div class="ttc" id="anamespacehelib_html_a4d6002f36f1a61982fded09adf1331ca"><div class="ttname"><a href="namespacehelib.html#a4d6002f36f1a61982fded09adf1331ca">helib::zzX</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; zzX</div><div class="ttdef"><b>Definition:</b> zzX.h:24</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_ab79e1f941d6043131a14404c68bf538c"><div class="ttname"><a href="classhelib_1_1_context.html#ab79e1f941d6043131a14404c68bf538c">helib::Context::noiseBoundForUniform</a></div><div class="ttdeci">double noiseBoundForUniform(double magBound, long degBound) const</div><div class="ttdef"><b>Definition:</b> Context.h:125</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a1e1a00b24fd8cef132e213b1b0c290bc"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a1e1a00b24fd8cef132e213b1b0c290bc">helib::PAlgebra::genToPow</a></div><div class="ttdeci">long genToPow(long i, long j) const</div><div class="ttdoc">the i'th generator to the power j mod m</div><div class="ttdef"><b>Definition:</b> PAlgebra.cpp:605</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a4b575e110984970e2f56f6b04731f55a"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a4b575e110984970e2f56f6b04731f55a">helib::EncryptedArrayBase::getP2R</a></div><div class="ttdeci">virtual long getP2R() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a79a4eb688187ecd60d37dd7c0b9e43a5"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a79a4eb688187ecd60d37dd7c0b9e43a5">helib::EncryptedArrayCx::encrypt</a></div><div class="ttdeci">void encrypt(Ctxt &amp;ctxt, const PubKey &amp;key, const PTXT &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1020</div></div>
<div class="ttc" id="a_double_c_r_t_8h_html"><div class="ttname"><a href="_double_c_r_t_8h.html">DoubleCRT.h</a></div><div class="ttdoc">Integer polynomials (elements in the ring R_Q) in double-CRT form.</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a407bacde3fcafde4071f6e6e37bc2771"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a407bacde3fcafde4071f6e6e37bc2771">helib::EncryptedArrayCx::clone</a></div><div class="ttdeci">EncryptedArrayBase * clone() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:735</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a852eac6fa3232bbc05e850759334580a"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a852eac6fa3232bbc05e850759334580a">helib::EncryptedArrayCx::random</a></div><div class="ttdeci">void random(std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1092</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a42dae93ce85090806f840ad3bc5ef069"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a42dae93ce85090806f840ad3bc5ef069">helib::EncryptedArrayCx::getTag</a></div><div class="ttdeci">PA_tag getTag() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:741</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_adfc198eb325759da0eb07e1edad86a2b"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#adfc198eb325759da0eb07e1edad86a2b">helib::PAlgebra::addCoord</a></div><div class="ttdeci">long addCoord(long i, long k, long offset) const</div><div class="ttdoc">adds offset to index k in the i'th dimension</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:272</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ae0cdc66cd6ea14bb1fa9b3748286b086"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ae0cdc66cd6ea14bb1fa9b3748286b086">helib::EncryptedArrayDerived::operator=</a></div><div class="ttdeci">EncryptedArrayDerived &amp; operator=(const EncryptedArrayDerived &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:365</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_af769f314f80561d0aad9420aabc98a86"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#af769f314f80561d0aad9420aabc98a86">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(NTL::ZZX &amp;ptxt, const PlaintextArray &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_double_c_r_t_html"><div class="ttname"><a href="classhelib_1_1_double_c_r_t.html">helib::DoubleCRT</a></div><div class="ttdoc">Implementing polynomials (elements in the ring R_Q) in double-CRT form.</div><div class="ttdef"><b>Definition:</b> DoubleCRT.h:76</div></div>
<div class="ttc" id="akeys_8h_html"><div class="ttname"><a href="keys_8h.html">keys.h</a></div><div class="ttdoc">Declaration of public key</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ac09d307b1cceced22a6c5717c467b3e7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ac09d307b1cceced22a6c5717c467b3e7">helib::EncryptedArrayDerived::rotate1D</a></div><div class="ttdeci">virtual void rotate1D(Ctxt &amp;ctxt, long i, long k, bool dc=false) const override</div><div class="ttdoc">right-rotate k positions along the i'th dimension</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:99</div></div>
<div class="ttc" id="anamespacehelib_html_aefd5d1a56f7036cae390706fe49e8fcb"><div class="ttname"><a href="namespacehelib.html#aefd5d1a56f7036cae390706fe49e8fcb">helib::plaintextAutomorph</a></div><div class="ttdeci">void plaintextAutomorph(RX &amp;bb, const RX &amp;a, long k, long m, const RXModulus &amp;PhimX)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1188</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ab921e7d1e4408b40e64880ed71c079df"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ab921e7d1e4408b40e64880ed71c079df">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED NTL::ZZX &amp;ptxt, UNUSED const PlaintextArray &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:816</div></div>
<div class="ttc" id="anamespacehelib_html_ab0181d82dc81ed4d1f8c1d950b4efd7eab33244c736f38a4c21e6d86c6a683d58"><div class="ttname"><a href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7eab33244c736f38a4c21e6d86c6a683d58">helib::PA_GF2_tag</a></div><div class="ttdeci">@ PA_GF2_tag</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:297</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aeae260ec0a6f65f82abdfd25a875e0a3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aeae260ec0a6f65f82abdfd25a875e0a3">helib::EncryptedArrayCx::extractImPart</a></div><div class="ttdeci">void extractImPart(Ptxt&lt; Scheme &gt; &amp;p) const</div><div class="ttdoc">Extract the imaginary part of a CKKS plaintext.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1147</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a5fe975d2c45ef2f25aaf5920c91627fe"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a5fe975d2c45ef2f25aaf5920c91627fe">helib::EncryptedArrayBase::getTag</a></div><div class="ttdeci">virtual PA_tag getTag() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a909891b441d50f99b13e5719ea7b1ce7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a909891b441d50f99b13e5719ea7b1ce7">helib::EncryptedArrayCx::random</a></div><div class="ttdeci">void random(UNUSED std::vector&lt; NTL::ZZX &gt; &amp;array) const override</div><div class="ttdoc">Unimplemented random function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:863</div></div>
<div class="ttc" id="anamespacehelib_html_ae977d2527a20cd02ae18841eea99aa2e"><div class="ttname"><a href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">helib::PolyRed</a></div><div class="ttdeci">void PolyRed(NTL::ZZX &amp;out, const NTL::ZZX &amp;in, long q, bool abs=false)</div><div class="ttdoc">Reduce all the coefficients of a polynomial modulo q.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:749</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a368c21a272921966da3a7793145bf5d2"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a368c21a272921966da3a7793145bf5d2">helib::EncryptedArrayBase::nativeDimension</a></div><div class="ttdeci">bool nativeDimension(long i) const</div><div class="ttdoc">Is rotations in given dimension a &quot;native&quot; operation?</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:287</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_aefb676e30745c2ce81df0384cf949df7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#aefb676e30745c2ce81df0384cf949df7">helib::EncryptedArrayBase::rotate1D</a></div><div class="ttdeci">void rotate1D(std::vector&lt; U &gt; &amp;out, const std::vector&lt; U &gt; &amp;in, long i, long offset) const</div><div class="ttdoc">rotate an array by offset in the i'th dimension (output should not alias input)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:304</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ae4f2249cd0f9cebc2539ba2609780ae1"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ae4f2249cd0f9cebc2539ba2609780ae1">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, PlaintextArray &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:565</div></div>
<div class="ttc" id="aclasshelib_1_1_logic_error_html"><div class="ttname"><a href="classhelib_1_1_logic_error.html">helib::LogicError</a></div><div class="ttdoc">Inherits from Exception and std::logic_error.</div><div class="ttdef"><b>Definition:</b> exceptions.h:68</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a1aa2691c70360cbb4836ab9d220ce245"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a1aa2691c70360cbb4836ab9d220ce245">helib::EncryptedArrayDerived::getDegree</a></div><div class="ttdeci">virtual long getDegree() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:429</div></div>
<div class="ttc" id="aclasshelib_1_1_mapping_data_html"><div class="ttname"><a href="classhelib_1_1_mapping_data.html">helib::MappingData</a></div><div class="ttdoc">Auxiliary structure to support encoding/decoding slots.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:474</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_derived_html_a3e923834650c8fedd2139b416edd5950"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_derived.html#a3e923834650c8fedd2139b416edd5950">helib::PAlgebraModDerived::restoreContext</a></div><div class="ttdeci">virtual void restoreContext() const override</div><div class="ttdoc">Restores the NTL context for p^r.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:625</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a2461039fb77ebf3fea8482adff2b40c0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a2461039fb77ebf3fea8482adff2b40c0">helib::EncryptedArrayBase::shift1D</a></div><div class="ttdeci">virtual void shift1D(Ctxt &amp;ctxt, long i, long k) const =0</div><div class="ttdoc">Right shift k positions along the i'th dimension with zero fill.</div></div>
<div class="ttc" id="anamespacehelib_html_adf575ea763b7454a6e8df566a9e64b3c"><div class="ttname"><a href="namespacehelib.html#adf575ea763b7454a6e8df566a9e64b3c">helib::applyPerm</a></div><div class="ttdeci">void applyPerm(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const NTL::Vec&lt; long &gt; &amp;pi)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1186</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_af8ff3f420efdf1d978e7647daf851b38"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#af8ff3f420efdf1d978e7647daf851b38">helib::EncryptedArrayDerived::decode</a></div><div class="ttdeci">virtual void decode(std::vector&lt; long &gt; &amp;array, const NTL::ZZX &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:515</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a0f887afd152534c4e5a698962b38565e"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a0f887afd152534c4e5a698962b38565e">helib::EncryptedArray::rotate</a></div><div class="ttdeci">void rotate(Ctxt &amp;ctxt, long k) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1309</div></div>
<div class="ttc" id="anamespacehelib_html_a305064dc4866c160a571bd653556c113"><div class="ttname"><a href="namespacehelib.html#a305064dc4866c160a571bd653556c113">helib::sub</a></div><div class="ttdeci">void sub(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1036</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a41642d04c74633f6c1a4d23dbde50054"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a41642d04c74633f6c1a4d23dbde50054">helib::EncryptedArray::restoreContextForG</a></div><div class="ttdeci">void restoreContextForG() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1364</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_af55d2066263a1a0f6abd9ab221a61f0c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#af55d2066263a1a0f6abd9ab221a61f0c">helib::EncryptedArrayBase::addCoord</a></div><div class="ttdeci">long addCoord(long i, long k, long offset) const</div><div class="ttdoc">adds offset to index k in the i'th dimension</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:296</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aa2d8dd041802b88703a472da3ad9150d"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aa2d8dd041802b88703a472da3ad9150d">helib::EncryptedArray::shift</a></div><div class="ttdeci">void shift(Ctxt &amp;ctxt, long k) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1310</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a578731eb6f1c9ee5c992e8cb8108a7bf"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a578731eb6f1c9ee5c992e8cb8108a7bf">helib::EncryptedArrayDerived::badDimensionAutomorphCorrection</a></div><div class="ttdeci">virtual void badDimensionAutomorphCorrection(Ctxt &amp;ctxt, long i, long k) const override</div><div class="ttdoc">Correct an automorphism in a bad dimension.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:64</div></div>
<div class="ttc" id="anamespacehelib_html_aec77ae5fa0fd11a0a42e07fefe49b99d"><div class="ttname"><a href="namespacehelib.html#aec77ae5fa0fd11a0a42e07fefe49b99d">helib::assertEq</a></div><div class="ttdeci">void assertEq(const T &amp;a, const T &amp;b, const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> assertions.h:108</div></div>
<div class="ttc" id="aclasshelib_1_1_mapping_data_html_af2df06fc054ae5ea95959c3b5c1db8ca"><div class="ttname"><a href="classhelib_1_1_mapping_data.html#af2df06fc054ae5ea95959c3b5c1db8ca">helib::MappingData::getDegG</a></div><div class="ttdeci">long getDegG() const</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:495</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_adb3be49bb5b91e3f7cca75c89877687f"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#adb3be49bb5b91e3f7cca75c89877687f">helib::EncryptedArrayCx::getDegree</a></div><div class="ttdeci">long getDegree() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:744</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a909d67c9c516ec5b4f99790f30068ff4"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a909d67c9c516ec5b4f99790f30068ff4">helib::EncryptedArray::decode</a></div><div class="ttdeci">void decode(ARRAY &amp;array, const PTXT &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1334</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aa8d1a159d42064013aec1f949bb47327"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aa8d1a159d42064013aec1f949bb47327">helib::EncryptedArray::getDerived</a></div><div class="ttdeci">const EncryptedArrayDerived&lt; type &gt; &amp; getDerived(type) const</div><div class="ttdoc">downcast operator example: const EncryptedArrayDerived&lt;PA_GF2&gt;&amp; rep = ea.getDerived(PA_GF2());</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1269</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html">helib::EncryptedArray</a></div><div class="ttdoc">A simple wrapper for a smart pointer to an EncryptedArrayBase. This is the interface that higher-leve...</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1237</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a72245213a18b9bafdd8ebc2396972c14"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a72245213a18b9bafdd8ebc2396972c14">helib::EncryptedArrayBase::shift</a></div><div class="ttdeci">virtual void shift(Ctxt &amp;ctxt, long k) const =0</div><div class="ttdoc">Non-cyclic right shift with zero fill E.g., shifting ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(0 1 2....</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a3beed1bc134ad9a4dbe6f6c4f456fee7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a3beed1bc134ad9a4dbe6f6c4f456fee7">helib::EncryptedArrayBase::rotate1D</a></div><div class="ttdeci">virtual void rotate1D(Ctxt &amp;ctxt, long i, long k, bool dc=false) const =0</div><div class="ttdoc">right-rotate k positions along the i'th dimension</div></div>
<div class="ttc" id="anamespacehelib_html_af7b15d5fbf553550437df6ca02d5a282"><div class="ttname"><a href="namespacehelib.html#af7b15d5fbf553550437df6ca02d5a282">helib::rem</a></div><div class="ttdeci">void rem(NTL::zz_pX &amp;r, const NTL::zz_pX &amp;a, const zz_pXModulus1 &amp;ff)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1737</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_aee12c18cec9f25f2e8b4208c7d32d1f7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#aee12c18cec9f25f2e8b4208c7d32d1f7">helib::EncryptedArrayDerived::getPAlgebra</a></div><div class="ttdeci">virtual const PAlgebra &amp; getPAlgebra() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:425</div></div>
<div class="ttc" id="anamespacehelib_html_ae2250fb1a88c915ce004837c63aa5ad7"><div class="ttname"><a href="namespacehelib.html#ae2250fb1a88c915ce004837c63aa5ad7">helib::shift</a></div><div class="ttdeci">void shift(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, long k)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:790</div></div>
<div class="ttc" id="aclasshelib_1_1_mapping_data_html_a0939fcc81b1ac4033a8a165ecd220ae1"><div class="ttname"><a href="classhelib_1_1_mapping_data.html#a0939fcc81b1ac4033a8a165ecd220ae1">helib::MappingData::restoreContextForG</a></div><div class="ttdeci">void restoreContextForG() const</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:496</div></div>
<div class="ttc" id="anamespacehelib_html_a21457a6ed2a6de2701b394bfcc90be1e"><div class="ttname"><a href="namespacehelib.html#a21457a6ed2a6de2701b394bfcc90be1e">helib::applyLinPolyLL</a></div><div class="ttdeci">void applyLinPolyLL(Ctxt &amp;ctxt, const std::vector&lt; P &gt; &amp;encodedC, long d)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:711</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_a4b9fb9574b016009f20def5bd3952269"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#a4b9fb9574b016009f20def5bd3952269">helib::PlaintextArray::getData</a></div><div class="ttdeci">const std::vector&lt; typename type::RX &gt; &amp; getData() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1449</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a37f5f723bf309bf9727d301ba0c9e915"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a37f5f723bf309bf9727d301ba0c9e915">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(UNUSED std::vector&lt; NTL::ZZX &gt; &amp;array, UNUSED const NTL::ZZX &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:840</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a795ee815c4701c02b683c7bb3a9a3518"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a795ee815c4701c02b683c7bb3a9a3518">helib::EncryptedArrayDerived::EncryptedArrayDerived</a></div><div class="ttdeci">EncryptedArrayDerived(const Context &amp;_context, const RX &amp;_G, const PAlgebraMod &amp;_tab)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:54</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_af8c628cad17d0545363424a7b69cb21f"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#af8c628cad17d0545363424a7b69cb21f">helib::EncryptedArray::nativeDimension</a></div><div class="ttdeci">long nativeDimension(long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1369</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a96caa13ce77bdabc4b7d679c28213c73"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a96caa13ce77bdabc4b7d679c28213c73">helib::EncryptedArrayBase::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, PlaintextArray &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_ptxt_html_ace682ff41a5f1833ae298aa8d33e05d5"><div class="ttname"><a href="classhelib_1_1_ptxt.html#ace682ff41a5f1833ae298aa8d33e05d5">helib::Ptxt::imag</a></div><div class="ttdeci">Ptxt&lt; Scheme &gt; imag() const</div><div class="ttdoc">Extract the imaginary part of a CKKS plaintext.</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a5741ce03114f74e26d3d842e3539806a"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a5741ce03114f74e26d3d842e3539806a">helib::EncryptedArrayBase::dimension</a></div><div class="ttdeci">long dimension() const</div><div class="ttdoc">Number of dimensions of hypercube.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:281</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_aebe917f60f1fa14b3f43d283e39c05f0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#aebe917f60f1fa14b3f43d283e39c05f0">helib::EncryptedArrayBase::getPAlgebra</a></div><div class="ttdeci">virtual const PAlgebra &amp; getPAlgebra() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ab3f8765108fc68df6296afb4845da57d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ab3f8765108fc68df6296afb4845da57d">helib::EncryptedArrayDerived::EncryptedArrayDerived</a></div><div class="ttdeci">EncryptedArrayDerived(const EncryptedArrayDerived &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:350</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a449d1c41fe9b41dd8c45f63ce6e4de89"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a449d1c41fe9b41dd8c45f63ce6e4de89">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">void decrypt(UNUSED const Ctxt &amp;ctxt, UNUSED const SecKey &amp;sKey, UNUSED std::vector&lt; cx_double &gt; &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decrypt function for CKKS. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:478</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a1c0a250013b889509a852aa74e3c29f0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a1c0a250013b889509a852aa74e3c29f0">helib::EncryptedArrayDerived::rotate</a></div><div class="ttdeci">virtual void rotate(Ctxt &amp;ctxt, long k) const override</div><div class="ttdoc">Right rotation as a linear array. E.g., rotating ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(n 1 2 ....</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:181</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html"><div class="ttname"><a href="classhelib_1_1_p_algebra.html">helib::PAlgebra</a></div><div class="ttdoc">The structure of (Z/mZ)* /(p)</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:77</div></div>
<div class="ttc" id="anamespacehelib_html_a7d7757fc124c051547f6d8d62f57e6ee"><div class="ttname"><a href="namespacehelib.html#a7d7757fc124c051547f6d8d62f57e6ee">helib::decode</a></div><div class="ttdeci">void decode(const EncryptedArray &amp;ea, std::vector&lt; long &gt; &amp;array, const PlaintextArray &amp;pa)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:902</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a377168a9d05375ab76ce34d8f6631582"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a377168a9d05375ab76ce34d8f6631582">helib::EncryptedArrayDerived::encode</a></div><div class="ttdeci">virtual void encode(zzX &amp;ptxt, const std::vector&lt; zzX &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:504</div></div>
<div class="ttc" id="anamespacehelib_html_af72790276847439369c96063c3cdc803"><div class="ttname"><a href="namespacehelib.html#af72790276847439369c96063c3cdc803">helib::totalSums</a></div><div class="ttdeci">void totalSums(const EncryptedArray &amp;ea, Ctxt &amp;ctxt)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:564</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a8f11ae63a7511a016c1ba28f293930a0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a8f11ae63a7511a016c1ba28f293930a0">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">void encode(zzX &amp;ptxt, const std::vector&lt; NTL::ZZX &gt; &amp;array) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:168</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a385a1b684e2ff6346f7b8e7425a6aacb"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a385a1b684e2ff6346f7b8e7425a6aacb">helib::EncryptedArrayBase::getDegree</a></div><div class="ttdeci">virtual long getDegree() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a20cdc66014104dd640f37c1c92e1fa05"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a20cdc66014104dd640f37c1c92e1fa05">helib::EncryptedArrayBase::buildLinPolyCoeffs</a></div><div class="ttdeci">virtual void buildLinPolyCoeffs(std::vector&lt; NTL::ZZX &gt; &amp;C, const std::vector&lt; NTL::ZZX &gt; &amp;L) const =0</div><div class="ttdoc">Linearized polynomials. L describes a linear map M by describing its action on the standard power bas...</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a3df75f4c6f7d6962041e01f608fd168d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a3df75f4c6f7d6962041e01f608fd168d">helib::EncryptedArrayCx::getP2R</a></div><div class="ttdeci">long getP2R() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:751</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ae31ef3579ef0b0d6cba0f805a9c80f50"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ae31ef3579ef0b0d6cba0f805a9c80f50">helib::EncryptedArrayBase::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; NTL::ZZX &gt; &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html">helib::EncryptedArrayBase</a></div><div class="ttdoc">virtual class for data-movement operations on arrays of slots</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:113</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ac07a62371be0a1c0ad617a04e147e000"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ac07a62371be0a1c0ad617a04e147e000">helib::EncryptedArrayDerived::shift1D</a></div><div class="ttdeci">virtual void shift1D(Ctxt &amp;ctxt, long i, long k) const override</div><div class="ttdoc">Right shift k positions along the i'th dimension with zero fill.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:130</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a6c08875c23130ae7eeea11189b5c50cf"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a6c08875c23130ae7eeea11189b5c50cf">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(NTL::ZZX &amp;ptxt, const std::vector&lt; long &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html">helib::EncryptedArrayCx</a></div><div class="ttdoc">A different derived class to be used for the approximate-numbers scheme.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:680</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_abdda60252affd27b27117b0b692db601"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#abdda60252affd27b27117b0b692db601">helib::EncryptedArray::shift1D</a></div><div class="ttdeci">void shift1D(Ctxt &amp;ctxt, long i, long k) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1315</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a4883d910df8cf214986647f84eb7531c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a4883d910df8cf214986647f84eb7531c">helib::EncryptedArrayBase::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; double &gt; &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a1f4d4caa1e488648194495688a06a6a3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a1f4d4caa1e488648194495688a06a6a3">helib::EncryptedArrayBase::coordinate</a></div><div class="ttdeci">long coordinate(long i, long k) const</div><div class="ttdoc">returns coordinate of index k along the i'th dimension</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:290</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a23ded635ce06ba41ecbf30b801f67e8b"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a23ded635ce06ba41ecbf30b801f67e8b">helib::EncryptedArray::sizeOfDimension</a></div><div class="ttdeci">long sizeOfDimension(long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1368</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_aff3d839e2e2976ef8c87853cf5a9cbb7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#aff3d839e2e2976ef8c87853cf5a9cbb7">helib::EncryptedArrayBase::clone</a></div><div class="ttdeci">virtual EncryptedArrayBase * clone() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a6a16e9c45db9d6b963cfeaf0c0afaca2"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a6a16e9c45db9d6b963cfeaf0c0afaca2">helib::EncryptedArrayBase::size</a></div><div class="ttdeci">long size() const</div><div class="ttdoc">Total size (# of slots) of hypercube.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:278</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html">helib::EncryptedArrayDerived</a></div><div class="ttdoc">Derived concrete implementation of EncryptedArrayBase.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:324</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_aee2981f3b0804e96f83106307d9c5be9"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#aee2981f3b0804e96f83106307d9c5be9">helib::EncryptedArrayBase::random</a></div><div class="ttdeci">virtual void random(std::vector&lt; long &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a7c69526bbb217d9731e628af68585b26"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a7c69526bbb217d9731e628af68585b26">helib::EncryptedArrayDerived::encode</a></div><div class="ttdeci">virtual void encode(zzX &amp;ptxt, const std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:493</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a5c2c2a01e6ea6c972904c1e98738fbd1"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a5c2c2a01e6ea6c972904c1e98738fbd1">helib::EncryptedArrayCx::extractRealPart</a></div><div class="ttdeci">void extractRealPart(Ctxt &amp;c) const</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:209</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a0fee8bb20e092b4728f2ed11c78bacc8"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a0fee8bb20e092b4728f2ed11c78bacc8">helib::EncryptedArrayCx::encodeUnitSelector</a></div><div class="ttdeci">void encodeUnitSelector(zzX &amp;ptxt, long i) const override</div><div class="ttdoc">Encodes a std::vector with 1 at position i and 0 everywhere else.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1028</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a95c835acdb8766ca3a9e733195dedba7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a95c835acdb8766ca3a9e733195dedba7">helib::EncryptedArrayDerived::restoreContext</a></div><div class="ttdeci">virtual void restoreContext() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:418</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a7c7e7d86e4cc50878cd108efc4e97c46"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a7c7e7d86e4cc50878cd108efc4e97c46">helib::EncryptedArrayCx::decrypt</a></div><div class="ttdeci">void decrypt(UNUSED const Ctxt &amp;ctxt, UNUSED const SecKey &amp;sKey, UNUSED std::vector&lt; NTL::ZZX &gt; &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decrypt function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:889</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aa4cd5c3c53cd6bd535e37ba2c4db4bd7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aa4cd5c3c53cd6bd535e37ba2c4db4bd7">helib::EncryptedArrayCx::convert</a></div><div class="ttdeci">static void convert(std::vector&lt; cx_double &gt; &amp;out, const std::vector&lt; long &gt; &amp;in)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:722</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a9b0e39d0510ca716372034ee14786c56"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a9b0e39d0510ca716372034ee14786c56">helib::EncryptedArrayDerived::random</a></div><div class="ttdeci">virtual void random(std::vector&lt; NTL::ZZX &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:538</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a551593e093a3e2e49028d3522da86906"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a551593e093a3e2e49028d3522da86906">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">void decrypt(UNUSED const Ctxt &amp;ctxt, UNUSED const SecKey &amp;sKey, UNUSED std::vector&lt; double &gt; &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decrypt function for CKKS. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:464</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ae87dba346c9f27331e552edd1511552f"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ae87dba346c9f27331e552edd1511552f">helib::EncryptedArrayBase::encodeUnitSelector</a></div><div class="ttdeci">virtual void encodeUnitSelector(zzX &amp;ptxt, long i) const =0</div><div class="ttdoc">Encodes a std::vector with 1 at position i and 0 everywhere else.</div></div>
<div class="ttc" id="anamespacehelib_html_ada22455ae91e6bacc49e719536a8c5da"><div class="ttname"><a href="namespacehelib.html#ada22455ae91e6bacc49e719536a8c5da">helib::clear</a></div><div class="ttdeci">void clear(zzX &amp;a)</div><div class="ttdef"><b>Definition:</b> zzX.h:28</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ae26a1447dca1803da3a54b394f8ff7f3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ae26a1447dca1803da3a54b394f8ff7f3">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(UNUSED std::vector&lt; long &gt; &amp;array, UNUSED const NTL::ZZX &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:829</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_cx_html_a5d2fd3234ccb5a63dd2a22d5e6dfcca0"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_cx.html#a5d2fd3234ccb5a63dd2a22d5e6dfcca0">helib::PAlgebraModCx::getZMStar</a></div><div class="ttdeci">const PAlgebra &amp; getZMStar() const override</div><div class="ttdoc">Returns reference to underlying PAlgebra object.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:773</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a9d95edb864185a146f2536a94b9eff80"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a9d95edb864185a146f2536a94b9eff80">helib::EncryptedArrayCx::encryptOneNum</a></div><div class="ttdeci">void encryptOneNum(Ctxt &amp;ctxt, const PubKey &amp;key, double num, double useThisSize=-1, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:984</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ada6929e7387f3fd6eb74ac762bbe1fcc"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ada6929e7387f3fd6eb74ac762bbe1fcc">helib::EncryptedArray::getContext</a></div><div class="ttdeci">const Context &amp; getContext() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1305</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a4e916710a3d770b1a5e258c27ba2ef86"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a4e916710a3d770b1a5e258c27ba2ef86">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED NTL::ZZX &amp;ptxt, UNUSED const std::vector&lt; NTL::ZZX &gt; &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:805</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a14f8a3b077bab6c697efc921fe358178"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a14f8a3b077bab6c697efc921fe358178">helib::EncryptedArrayDerived::random</a></div><div class="ttdeci">virtual void random(std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:532</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_acb9a52b2aae4f41b6ac4a1ababec282a"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#acb9a52b2aae4f41b6ac4a1ababec282a">helib::EncryptedArray::getAlMod</a></div><div class="ttdeci">const PAlgebraMod &amp; getAlMod() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1306</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aa31b4620c1888b0daf353c4947203b2c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aa31b4620c1888b0daf353c4947203b2c">helib::EncryptedArrayCx::getContext</a></div><div class="ttdeci">const Context &amp; getContext() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:742</div></div>
<div class="ttc" id="anamespacehelib_html_aa271293d5f46187af89cc81ecb0235e9"><div class="ttname"><a href="namespacehelib.html#aa271293d5f46187af89cc81ecb0235e9">helib::equals</a></div><div class="ttdeci">bool equals(const EncryptedArray &amp;ea, const PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:960</div></div>
<div class="ttc" id="anamespacehelib_html_ab0181d82dc81ed4d1f8c1d950b4efd7e"><div class="ttname"><a href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7e">helib::PA_tag</a></div><div class="ttdeci">PA_tag</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:296</div></div>
<div class="ttc" id="a_p_algebra_8h_html_a3f121e88d1ede1fd384a8ad4ebb51f41"><div class="ttname"><a href="_p_algebra_8h.html#a3f121e88d1ede1fd384a8ad4ebb51f41">PA_INJECT</a></div><div class="ttdeci">#define PA_INJECT(typ)</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:447</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aa3175ec1734ff04440b8df29ec4cf2f4"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aa3175ec1734ff04440b8df29ec4cf2f4">helib::EncryptedArray::encode</a></div><div class="ttdeci">void encode(PTXT &amp;ptxt, const ARRAY &amp;array) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1323</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a64f75f243718856305758a8a39834a00"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a64f75f243718856305758a8a39834a00">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(zzX &amp;ptxt, const std::vector&lt; zzX &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ac12a59e0c752ad844b5442f8df150449"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ac12a59e0c752ad844b5442f8df150449">helib::EncryptedArrayDerived::buildLinPolyCoeffs</a></div><div class="ttdeci">virtual void buildLinPolyCoeffs(std::vector&lt; NTL::ZZX &gt; &amp;C, const std::vector&lt; NTL::ZZX &gt; &amp;L) const override</div><div class="ttdoc">Linearized polynomials. L describes a linear map M by describing its action on the standard power bas...</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:602</div></div>
<div class="ttc" id="anamespacehelib_html_a38c7c1b517a8ec41eacfc5c2dba6e293"><div class="ttname"><a href="namespacehelib.html#a38c7c1b517a8ec41eacfc5c2dba6e293">helib::random</a></div><div class="ttdeci">void random(const EncryptedArray &amp;ea, PlaintextArray &amp;pa)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:878</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a91e0ea6381b603ca278ac1ca64b289f7"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a91e0ea6381b603ca278ac1ca64b289f7">helib::EncryptedArray::buildLinPolyCoeffs</a></div><div class="ttdeci">void buildLinPolyCoeffs(std::vector&lt; NTL::ZZX &gt; &amp;C, const std::vector&lt; NTL::ZZX &gt; &amp;L) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1357</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a7b4ebc9251cd7e1966c5da70f51fb369"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a7b4ebc9251cd7e1966c5da70f51fb369">helib::EncryptedArrayBase::sizeOfDimension</a></div><div class="ttdeci">long sizeOfDimension(long i) const</div><div class="ttdoc">Size of given dimension.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:284</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a4008456c8aaeaf459a8ee001b1dbf21f"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a4008456c8aaeaf459a8ee001b1dbf21f">helib::EncryptedArrayDerived::rotate1D</a></div><div class="ttdeci">void rotate1D(std::vector&lt; U &gt; &amp;out, const std::vector&lt; U &gt; &amp;in, long i, long offset) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:447</div></div>
<div class="ttc" id="anamespacehelib_html_a83b1a8080de040baddd971b44488ca51"><div class="ttname"><a href="namespacehelib.html#a83b1a8080de040baddd971b44488ca51">helib::power</a></div><div class="ttdeci">void power(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, long e)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1146</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ac226637f8cf23a177ae75f5bbedd35e9"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ac226637f8cf23a177ae75f5bbedd35e9">helib::EncryptedArray::getDegree</a></div><div class="ttdeci">long getDegree() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1308</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_afee5218d346a7d0c27fcf4f72bd1fe8c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#afee5218d346a7d0c27fcf4f72bd1fe8c">helib::EncryptedArrayDerived::encode</a></div><div class="ttdeci">virtual void encode(NTL::ZZX &amp;ptxt, const std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:487</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html">helib::PlaintextArray</a></div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1410</div></div>
<div class="ttc" id="aapi_attributes_8h_html_addf5ec070e9499d36b7f2009ce736076"><div class="ttname"><a href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a></div><div class="ttdeci">#define UNUSED</div><div class="ttdef"><b>Definition:</b> apiAttributes.h:31</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a3fcb15513e4d89d0c0ed4bda3fca2190"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a3fcb15513e4d89d0c0ed4bda3fca2190">helib::EncryptedArrayBase::~EncryptedArrayBase</a></div><div class="ttdeci">virtual ~EncryptedArrayBase()</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:115</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_cx_html_ad6761a53cc4fe80e280958782b18f31e"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_cx.html#ad6761a53cc4fe80e280958782b18f31e">helib::PAlgebraModCx::getPPowR</a></div><div class="ttdeci">long getPPowR() const override</div><div class="ttdoc">The value p^r.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:775</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a67585c6eeb53cb6bcd1f48f41f9e05a9"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a67585c6eeb53cb6bcd1f48f41f9e05a9">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; NTL::ZZX &gt; &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:554</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_base_html"><div class="ttname"><a href="classhelib_1_1_plaintext_array_base.html">helib::PlaintextArrayBase</a></div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1392</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a427d4228e407fbf694191ad18842e90d"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a427d4228e407fbf694191ad18842e90d">helib::PAlgebra::SameOrd</a></div><div class="ttdeci">bool SameOrd(long i) const</div><div class="ttdoc">Is ord(i'th generator) the same as its order in (Z/mZ)^*?</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:223</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a47944c462c09ff14b3d8dda332e66325"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a47944c462c09ff14b3d8dda332e66325">helib::EncryptedArrayDerived::shift</a></div><div class="ttdeci">virtual void shift(Ctxt &amp;ctxt, long k) const override</div><div class="ttdoc">Non-cyclic right shift with zero fill E.g., shifting ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(0 1 2....</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:289</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ae5ce92c28f92efd122a6f93fed3c42a7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ae5ce92c28f92efd122a6f93fed3c42a7">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED zzX &amp;ptxt, UNUSED const std::vector&lt; zzX &gt; &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:783</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a77cc1a6041c4d442bb3a3858afc5f12c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a77cc1a6041c4d442bb3a3858afc5f12c">helib::EncryptedArrayDerived::encodeUnitSelector</a></div><div class="ttdeci">virtual void encodeUnitSelector(zzX &amp;ptxt, long i) const override</div><div class="ttdoc">Encodes a std::vector with 1 at position i and 0 everywhere else.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:418</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a84a23e382804d2ed776dd7eebe65c41e"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a84a23e382804d2ed776dd7eebe65c41e">helib::EncryptedArrayCx::roundedSize</a></div><div class="ttdeci">static double roundedSize(double x)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:686</div></div>
<div class="ttc" id="anamespacehelib_html_ad61eac49543dd3559b386f94ca7112c9"><div class="ttname"><a href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">helib::resize</a></div><div class="ttdeci">void resize(NTL::Vec&lt; T &gt; &amp;v, long sz, const T &amp;val)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:695</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html_ad1ae403520999ebf024a8c664e74ea41"><div class="ttname"><a href="classhelib_1_1_ctxt.html#ad1ae403520999ebf024a8c664e74ea41">helib::Ctxt::getPtxtSpace</a></div><div class="ttdeci">long getPtxtSpace() const</div><div class="ttdef"><b>Definition:</b> Ctxt.h:767</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a1a8bd7eeef62309e6c872a45e9d50b6e"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a1a8bd7eeef62309e6c872a45e9d50b6e">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED zzX &amp;ptxt, UNUSED const std::vector&lt; long &gt; &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:761</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_ac0897608adff0c1e2e558968cbe96a3d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#ac0897608adff0c1e2e558968cbe96a3d">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(std::vector&lt; double &gt; &amp;array, const NTL::ZZX &amp;ptxt, double scaling) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1076</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a7d8d25cd71e1ca0bd7a287b18965d7c4"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a7d8d25cd71e1ca0bd7a287b18965d7c4">helib::EncryptedArrayCx::rotate</a></div><div class="ttdeci">void rotate(Ctxt &amp;ctxt, long k) const override</div><div class="ttdoc">Right rotation as a linear array. E.g., rotating ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(n 1 2 ....</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:123</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a148c2b99586850a69ca19ab2b7fd562e"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a148c2b99586850a69ca19ab2b7fd562e">helib::EncryptedArrayDerived::dispatch</a></div><div class="ttdeci">void dispatch(Args &amp;&amp;... args) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:395</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a43affe53523fea549000a6c5a649a3d8"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a43affe53523fea549000a6c5a649a3d8">helib::EncryptedArray::rotate1D</a></div><div class="ttdeci">void rotate1D(std::vector&lt; U &gt; &amp;out, const std::vector&lt; U &gt; &amp;in, long i, long offset) const</div><div class="ttdoc">rotate an array by offset in the i'th dimension (output should not alias input)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1379</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aee83a1b81625a43d1d819e3740b2a3b4"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aee83a1b81625a43d1d819e3740b2a3b4">helib::EncryptedArrayCx::badDimensionAutomorphCorrection</a></div><div class="ttdeci">void badDimensionAutomorphCorrection(Ctxt &amp;ctxt, long i, long k) const override</div><div class="ttdoc">Correct an automorphism in a bad dimension.</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:293</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a579c0568094fd700b471567ee82f731c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a579c0568094fd700b471567ee82f731c">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; long &gt; &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:543</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a20151d8001b05fadd502f4992079dd1c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a20151d8001b05fadd502f4992079dd1c">helib::EncryptedArrayDerived::decrypt</a></div><div class="ttdeci">void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; RX &gt; &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:598</div></div>
<div class="ttc" id="aclasshelib_1_1_pub_key_html"><div class="ttname"><a href="classhelib_1_1_pub_key.html">helib::PubKey</a></div><div class="ttdoc">The public key.</div><div class="ttdef"><b>Definition:</b> keys.h:47</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ab02ad165d8df163bc6d8c544f8f81bbd"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ab02ad165d8df163bc6d8c544f8f81bbd">helib::EncryptedArrayBase::rotate</a></div><div class="ttdeci">virtual void rotate(Ctxt &amp;ctxt, long k) const =0</div><div class="ttdoc">Right rotation as a linear array. E.g., rotating ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(n 1 2 ....</div></div>
<div class="ttc" id="aclasshelib_1_1_pub_key_html_aafbfc62d5d78c39aa7929d552b31ff03"><div class="ttname"><a href="classhelib_1_1_pub_key.html#aafbfc62d5d78c39aa7929d552b31ff03">helib::PubKey::CKKSencrypt</a></div><div class="ttdeci">void CKKSencrypt(Ctxt &amp;ciphertxt, const NTL::ZZX &amp;plaintxt, double ptxtSize=1.0, double scaling=0.0) const</div><div class="ttdef"><b>Definition:</b> keys.cpp:497</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ae5927ca8c689a115ee2c12522289255f"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ae5927ca8c689a115ee2c12522289255f">helib::EncryptedArrayBase::restoreContextForG</a></div><div class="ttdeci">virtual void restoreContextForG() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:273</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a000a070007229db34150a3dcbb45f886"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a000a070007229db34150a3dcbb45f886">helib::EncryptedArrayBase::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; cx_double &gt; &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_pub_key_html_a0346c2c214b648809f6b754de9e5d431"><div class="ttname"><a href="classhelib_1_1_pub_key.html#a0346c2c214b648809f6b754de9e5d431">helib::PubKey::Encrypt</a></div><div class="ttdeci">long Encrypt(Ctxt &amp;ciphertxt, const NTL::ZZX &amp;plaintxt, long ptxtSpace, bool highNoise) const</div><div class="ttdef"><b>Definition:</b> keys.cpp:353</div></div>
<div class="ttc" id="anamespacehelib_html_a719cb433e43e9f4a88ada8b72d3b715d"><div class="ttname"><a href="namespacehelib.html#a719cb433e43e9f4a88ada8b72d3b715d">helib::cx_double</a></div><div class="ttdeci">std::complex&lt; double &gt; cx_double</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:32</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="anamespacehelib_html_ab42c58780be6927575c8548d842f47b9"><div class="ttname"><a href="namespacehelib.html#ab42c58780be6927575c8548d842f47b9">helib::incrementalZeroTest</a></div><div class="ttdeci">void incrementalZeroTest(Ctxt *res[], const EncryptedArray &amp;ea, const Ctxt &amp;ctxt, long n)</div><div class="ttdef"><b>Definition:</b> eqtesting.cpp:95</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a7b245c39644ac52a7040ba18f57ad704"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a7b245c39644ac52a7040ba18f57ad704">helib::EncryptedArrayDerived::getP2R</a></div><div class="ttdeci">long getP2R() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:443</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_derived_html"><div class="ttname"><a href="classhelib_1_1_plaintext_array_derived.html">helib::PlaintextArrayDerived</a></div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1400</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a4a081671bfa69eb6938d12446bbc4853"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a4a081671bfa69eb6938d12446bbc4853">helib::EncryptedArrayDerived::getG</a></div><div class="ttdeci">const RX &amp; getG() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:400</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_base_html_a9255ca3ff65ca9e9c7f1a5ef5d24e80e"><div class="ttname"><a href="classhelib_1_1_plaintext_array_base.html#a9255ca3ff65ca9e9c7f1a5ef5d24e80e">helib::PlaintextArrayBase::~PlaintextArrayBase</a></div><div class="ttdeci">virtual ~PlaintextArrayBase()</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1394</div></div>
<div class="ttc" id="anamespacehelib_html_a55aba5934157b9d7517101534a0053a2"><div class="ttname"><a href="namespacehelib.html#a55aba5934157b9d7517101534a0053a2">helib::runningSums</a></div><div class="ttdeci">void runningSums(const EncryptedArray &amp;ea, Ctxt &amp;ctxt)</div><div class="ttdoc">A ctxt that encrypts  is replaced by an encryption of , where .</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:551</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a2bb0704f701023769bb7cc985fd18e73"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a2bb0704f701023769bb7cc985fd18e73">helib::EncryptedArrayCx::random</a></div><div class="ttdeci">void random(std::vector&lt; double &gt; &amp;array, double rad=1.0) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1086</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a5bea11d6a177b18c3085e37fa5af5c20"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a5bea11d6a177b18c3085e37fa5af5c20">helib::EncryptedArrayCx::decrypt</a></div><div class="ttdeci">void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; double &gt; &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1102</div></div>
<div class="ttc" id="a_ctxt_8h_html"><div class="ttname"><a href="_ctxt_8h.html">Ctxt.h</a></div><div class="ttdoc">Declarations of a BGV-type ciphertext and key-switching matrices.</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a789cc5597002e684315cabbef6c42de8"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a789cc5597002e684315cabbef6c42de8">helib::EncryptedArrayBase::decode</a></div><div class="ttdeci">virtual void decode(PlaintextArray &amp;array, const NTL::ZZX &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a93bf7ceecb7cef0259b5eddeb25a3c28"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a93bf7ceecb7cef0259b5eddeb25a3c28">helib::EncryptedArrayBase::encode</a></div><div class="ttdeci">virtual void encode(zzX &amp;ptxt, const std::vector&lt; long &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_a637857c499280edd1accf56c85d4cc77"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#a637857c499280edd1accf56c85d4cc77">helib::PlaintextArray::operator=</a></div><div class="ttdeci">PlaintextArray &amp; operator=(const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1436</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aac8802bf761211269b152fe080301136"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aac8802bf761211269b152fe080301136">helib::EncryptedArray::coordinate</a></div><div class="ttdeci">long coordinate(long i, long k) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1370</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ab5f2dc888e3749fc056f07607718d40d"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ab5f2dc888e3749fc056f07607718d40d">helib::EncryptedArray::badDimensionAutomorphCorrection</a></div><div class="ttdeci">void badDimensionAutomorphCorrection(Ctxt &amp;ctxt, long i, long amt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1317</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aca004382bb4e4226ba45634f4302d8c0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aca004382bb4e4226ba45634f4302d8c0">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">void encode(UNUSED zzX &amp;ptxt, UNUSED const PlaintextArray &amp;array) const override</div><div class="ttdoc">Unimplemented encode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:794</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a334f5f8c9e7d0f951c117b200efe127d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a334f5f8c9e7d0f951c117b200efe127d">helib::EncryptedArrayDerived::getNormalBasisMatrixInverse</a></div><div class="ttdeci">const NTL::Mat&lt; R &gt; &amp; getNormalBasisMatrixInverse() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:409</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a454ee083696fe4e2b56ed18dae023722"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a454ee083696fe4e2b56ed18dae023722">helib::EncryptedArrayBase::decrypt1Slot</a></div><div class="ttdeci">void decrypt1Slot(NTL::ZZX &amp;slot, const Ctxt &amp;ctxt, const SecKey &amp;sKey, long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:247</div></div>
<div class="ttc" id="anamespacehelib_html_addc58993c7093dd07d98335bab200e82"><div class="ttname"><a href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">helib::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:189</div></div>
<div class="ttc" id="aclasshelib_1_1_ptxt_html_a1ac29a900263dbba14e9a48e651b9159"><div class="ttname"><a href="classhelib_1_1_ptxt.html#a1ac29a900263dbba14e9a48e651b9159">helib::Ptxt::setData</a></div><div class="ttdeci">void setData(const std::vector&lt; SlotType &gt; &amp;data)</div><div class="ttdoc">Set the data.</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_af6adfaf69bf5ce786122da95a4c2bf9e"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#af6adfaf69bf5ce786122da95a4c2bf9e">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(std::vector&lt; double &gt; &amp;array, const zzX &amp;ptxt, double scaling) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1069</div></div>
<div class="ttc" id="anamespacehelib_html_aa8e520a1528ee0d150a9818c7ddc4850"><div class="ttname"><a href="namespacehelib.html#aa8e520a1528ee0d150a9818c7ddc4850">helib::applyLinPolyMany</a></div><div class="ttdeci">void applyLinPolyMany(const EncryptedArray &amp;ea, Ctxt &amp;ctxt, const std::vector&lt; std::vector&lt; NTL::ZZX &gt;&gt; &amp;Cvec)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:682</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_base_html_a36bc0c395cf1f03648618c25cd2d9ccc"><div class="ttname"><a href="classhelib_1_1_plaintext_array_base.html#a36bc0c395cf1f03648618c25cd2d9ccc">helib::PlaintextArrayBase::print</a></div><div class="ttdeci">virtual void print(std::ostream &amp;s) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_afa9e2e8c44f575c2f47c6151c71cf8c5"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#afa9e2e8c44f575c2f47c6151c71cf8c5">helib::EncryptedArrayCx::decrypt</a></div><div class="ttdeci">void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, Ptxt&lt; Scheme &gt; &amp;ptxt) const</div><div class="ttdoc">Decrypt ciphertext to a plaintext relative to a specific scheme.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1121</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a4dad92fbceda699b62904e4418ae122c"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a4dad92fbceda699b62904e4418ae122c">helib::EncryptedArrayCx::convert</a></div><div class="ttdeci">static void convert(std::vector&lt; cx_double &gt; &amp;out, const std::vector&lt; double &gt; &amp;in)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:708</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a1b802f329dd409388d9da48cd8218726"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a1b802f329dd409388d9da48cd8218726">helib::EncryptedArray::encodeUnitSelector</a></div><div class="ttdeci">void encodeUnitSelector(zzX &amp;ptxt, long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1328</div></div>
<div class="ttc" id="a_context_8h_html"><div class="ttname"><a href="_context_8h.html">Context.h</a></div><div class="ttdoc">Keeps the parameters of an instance of the cryptosystem.</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a5e06f07495e1753090a36084f0567c24"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a5e06f07495e1753090a36084f0567c24">helib::EncryptedArrayCx::shift</a></div><div class="ttdeci">void shift(Ctxt &amp;ctxt, long k) const override</div><div class="ttdoc">Non-cyclic right shift with zero fill E.g., shifting ctxt=Enc(1 2 3 ... n) by k=1 gives Enc(0 1 2....</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:127</div></div>
<div class="ttc" id="anamespacehelib_html_ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee"><div class="ttname"><a href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea7d944116ae9eb1abb2d5fa92bb6d21ee">helib::PA_cx_tag</a></div><div class="ttdeci">@ PA_cx_tag</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:299</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a54e197fb8f924535b79bf1cb0fd62ce3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a54e197fb8f924535b79bf1cb0fd62ce3">helib::EncryptedArrayBase::random</a></div><div class="ttdeci">virtual void random(std::vector&lt; NTL::ZZX &gt; &amp;array) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_aee03f28f6d616e8109966f711c299f47"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#aee03f28f6d616e8109966f711c299f47">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(std::vector&lt; cx_double &gt; &amp;array, const NTL::ZZX &amp;ptxt, double scaling) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1060</div></div>
<div class="ttc" id="anamespacehelib_html_a583abeb8ab8021559fb519621b42c3d7"><div class="ttname"><a href="namespacehelib.html#a583abeb8ab8021559fb519621b42c3d7">helib::applyLinPoly1</a></div><div class="ttdeci">void applyLinPoly1(const EncryptedArray &amp;ea, Ctxt &amp;ctxt, const std::vector&lt; NTL::ZZX &gt; &amp;C)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:658</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a333b490a6f284b78172e0e62092ea603"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a333b490a6f284b78172e0e62092ea603">helib::EncryptedArrayCx::extractRealPart</a></div><div class="ttdeci">void extractRealPart(Ptxt&lt; Scheme &gt; &amp;p) const</div><div class="ttdoc">Extract the real part of a CKKS plaintext.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1136</div></div>
<div class="ttc" id="anamespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div><div class="ttdef"><b>Definition:</b> Test_EvalMap.cpp:12</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_aedb467d9a37f866be26575bcdebe4401"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#aedb467d9a37f866be26575bcdebe4401">helib::EncryptedArrayDerived::getContext</a></div><div class="ttdeci">virtual const Context &amp; getContext() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:424</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_ab9b7baf29ff926acd6cfa8b8d00bf800"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#ab9b7baf29ff926acd6cfa8b8d00bf800">helib::EncryptedArrayBase::decode1Slot</a></div><div class="ttdeci">long decode1Slot(const NTL::ZZX &amp;ptxt, long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:189</div></div>
<div class="ttc" id="aclasshelib_1_1_sec_key_html"><div class="ttname"><a href="classhelib_1_1_sec_key.html">helib::SecKey</a></div><div class="ttdoc">The secret key.</div><div class="ttdef"><b>Definition:</b> keys.h:225</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_afb2bad9633f98f52f81a7670c0d9bef4"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#afb2bad9633f98f52f81a7670c0d9bef4">helib::PAlgebra::coordinate</a></div><div class="ttdeci">long coordinate(long i, long k) const</div><div class="ttdoc">Returns coordinate of index k along the i'th dimension.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:257</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html"><div class="ttname"><a href="classhelib_1_1_context.html">helib::Context</a></div><div class="ttdoc">Maintaining the parameters.</div><div class="ttdef"><b>Definition:</b> Context.h:58</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aa014f79a12bb1ca61a83ec3a1f43d858"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aa014f79a12bb1ca61a83ec3a1f43d858">helib::EncryptedArray::decrypt</a></div><div class="ttdeci">void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, T &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1352</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a4a83958f46369fac784b7fa6e4d6fa33"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a4a83958f46369fac784b7fa6e4d6fa33">helib::EncryptedArray::EncryptedArray</a></div><div class="ttdeci">EncryptedArray(const Context &amp;context, const NTL::ZZX &amp;G=NTL::ZZX(1, 1))</div><div class="ttdoc">constructor: G defaults to the monomial X, PAlgebraMod from context</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1244</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a8816c7ea0d50a3667a7c9a4aaab903d5"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a8816c7ea0d50a3667a7c9a4aaab903d5">helib::EncryptedArrayCx::encodei</a></div><div class="ttdeci">double encodei(zzX &amp;ptxt, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:169</div></div>
<div class="ttc" id="anamespacehelib_html_acf08ccbcd03824fa3825640c1b171481"><div class="ttname"><a href="namespacehelib.html#acf08ccbcd03824fa3825640c1b171481">helib::encode</a></div><div class="ttdeci">void encode(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const std::vector&lt; long &gt; &amp;array)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:827</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ad5fc659aaaeeb403f21b3c5a951768ce"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ad5fc659aaaeeb403f21b3c5a951768ce">helib::EncryptedArray::operator=</a></div><div class="ttdeci">EncryptedArray &amp; operator=(const EncryptedArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1254</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_html"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod.html">helib::PAlgebraMod</a></div><div class="ttdoc">The structure of Z[X]/(Phi_m(X), p)</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:798</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a8367c993fd304e5633ec0af3942d9dde"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a8367c993fd304e5633ec0af3942d9dde">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">double encode(zzX &amp;ptxt, const std::vector&lt; long &gt; &amp;array, double useThisSize, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:939</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a759888cad7e21adc991832246d9ca3a2"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a759888cad7e21adc991832246d9ca3a2">helib::EncryptedArrayCx::EncryptedArrayCx</a></div><div class="ttdeci">EncryptedArrayCx(const Context &amp;_context)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:696</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ae80adc5a72904c36d8c174ee032b7208"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ae80adc5a72904c36d8c174ee032b7208">helib::EncryptedArrayDerived::clone</a></div><div class="ttdeci">virtual EncryptedArrayBase * clone() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:386</div></div>
<div class="ttc" id="aclasshelib_1_1_ptxt_html_ae1a0c1d39f2077bede420a150d459e1d"><div class="ttname"><a href="classhelib_1_1_ptxt.html#ae1a0c1d39f2077bede420a150d459e1d">helib::Ptxt::real</a></div><div class="ttdeci">Ptxt&lt; Scheme &gt; real() const</div><div class="ttdoc">Extract the real part of a CKKS plaintext.</div></div>
<div class="ttc" id="anamespacehelib_html_ab0181d82dc81ed4d1f8c1d950b4efd7ea63d35380340004730e7cb505a4da38e2"><div class="ttname"><a href="namespacehelib.html#ab0181d82dc81ed4d1f8c1d950b4efd7ea63d35380340004730e7cb505a4da38e2">helib::PA_zz_p_tag</a></div><div class="ttdeci">@ PA_zz_p_tag</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:298</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a6f262de0581bb42862bfd5edbdc1b79d"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a6f262de0581bb42862bfd5edbdc1b79d">helib::EncryptedArrayCx::rotate1D</a></div><div class="ttdeci">void rotate1D(Ctxt &amp;ctxt, long i, long k, bool dc=false) const override</div><div class="ttdoc">right-rotate k positions along the i'th dimension</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:91</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_a277e318dc8908b0ce8f8734b978a093f"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#a277e318dc8908b0ce8f8734b978a093f">helib::PlaintextArray::PlaintextArray</a></div><div class="ttdeci">PlaintextArray(const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1435</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_ab46f85fab47332239f119caee09ececf"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#ab46f85fab47332239f119caee09ececf">helib::EncryptedArrayDerived::decode</a></div><div class="ttdeci">virtual void decode(std::vector&lt; NTL::ZZX &gt; &amp;array, const NTL::ZZX &amp;ptxt) const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:521</div></div>
<div class="ttc" id="anamespacehelib_html_a2f6016d5e65b16abb1feba5a82067b14"><div class="ttname"><a href="namespacehelib.html#a2f6016d5e65b16abb1feba5a82067b14">helib::negate</a></div><div class="ttdeci">void negate(const EncryptedArray &amp;ea, PlaintextArray &amp;pa)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1088</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ab7cb2f5fdc1c7d4f98e4b6cd7a1bf2fc"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ab7cb2f5fdc1c7d4f98e4b6cd7a1bf2fc">helib::EncryptedArray::restoreContext</a></div><div class="ttdeci">void restoreContext() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1363</div></div>
<div class="ttc" id="anamespacehelib_html_a4d0fb010c5631535fe448caabc974860"><div class="ttname"><a href="namespacehelib.html#a4d0fb010c5631535fe448caabc974860">helib::mapTo01</a></div><div class="ttdeci">void mapTo01(const EncryptedArray &amp;ea, Ctxt &amp;ctxt)</div><div class="ttdef"><b>Definition:</b> eqtesting.cpp:35</div></div>
<div class="ttc" id="aclasshelib_1_1_ptxt_html_a9079d2c55de7a19af137da3d042c50d4"><div class="ttname"><a href="classhelib_1_1_ptxt.html#a9079d2c55de7a19af137da3d042c50d4">helib::Ptxt::getSlotRepr</a></div><div class="ttdeci">const std::vector&lt; SlotType &gt; &amp; getSlotRepr() const</div><div class="ttdoc">Get the data held in the slots as a std::vector&lt;SlotType&gt;.</div><div class="ttdef"><b>Definition:</b> Ptxt.cpp:184</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_adafe0d6e2cc46d72ed92629568260913"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#adafe0d6e2cc46d72ed92629568260913">helib::EncryptedArrayCx::decode</a></div><div class="ttdeci">void decode(UNUSED PlaintextArray &amp;array, UNUSED const NTL::ZZX &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decode function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:851</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a034157a2fb376284fa951f20570e02d0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a034157a2fb376284fa951f20570e02d0">helib::EncryptedArrayBase::decode</a></div><div class="ttdeci">virtual void decode(std::vector&lt; NTL::ZZX &gt; &amp;array, const NTL::ZZX &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_html_a5e4b044f71ca8edcfa4426cb199461f0"><div class="ttname"><a href="classhelib_1_1_p_algebra.html#a5e4b044f71ca8edcfa4426cb199461f0">helib::PAlgebra::numOfGens</a></div><div class="ttdeci">long numOfGens() const</div><div class="ttdoc">The prime-power factorization of m.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:202</div></div>
<div class="ttc" id="anamespacehelib_html_ab08d6e1c47a1f0b8ed57aff211929548"><div class="ttname"><a href="namespacehelib.html#ab08d6e1c47a1f0b8ed57aff211929548">helib::frobeniusAutomorph</a></div><div class="ttdeci">void frobeniusAutomorph(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, long j)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1134</div></div>
<div class="ttc" id="anamespacehelib_html_a42185bbb249368e34f515e09e90bc7b0"><div class="ttname"><a href="namespacehelib.html#a42185bbb249368e34f515e09e90bc7b0">helib::add</a></div><div class="ttdeci">void add(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1008</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a51692448b383260437f94880699ec0b8"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a51692448b383260437f94880699ec0b8">helib::EncryptedArray::encrypt</a></div><div class="ttdeci">void encrypt(Ctxt &amp;ctxt, const PubKey &amp;pKey, const T &amp;ptxt) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1346</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_adc1452ff938cb0b4cf5f3d6aa335caaa"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#adc1452ff938cb0b4cf5f3d6aa335caaa">helib::EncryptedArray::dimension</a></div><div class="ttdeci">long dimension() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1367</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_acfdec26873763a9b20daf3206a273146"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#acfdec26873763a9b20daf3206a273146">helib::EncryptedArrayBase::decode1Slot</a></div><div class="ttdeci">void decode1Slot(NTL::ZZX &amp;slot, const NTL::ZZX &amp;ptxt, long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:195</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a421628840dc807f1f0c2265c763176ed"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a421628840dc807f1f0c2265c763176ed">helib::EncryptedArrayCx::convert</a></div><div class="ttdeci">static void convert(std::vector&lt; double &gt; &amp;out, const std::vector&lt; cx_double &gt; &amp;in)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:715</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a4e8c39c8730c5072e36f37aaa28eccbb"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a4e8c39c8730c5072e36f37aaa28eccbb">helib::EncryptedArrayBase::decrypt</a></div><div class="ttdeci">virtual void decrypt(const Ctxt &amp;ctxt, const SecKey &amp;sKey, std::vector&lt; long &gt; &amp;ptxt) const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_acb343e9ad9fe202a7386fc8359346a02"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#acb343e9ad9fe202a7386fc8359346a02">helib::EncryptedArrayBase::decrypt1Slot</a></div><div class="ttdeci">long decrypt1Slot(const Ctxt &amp;ctxt, const SecKey &amp;sKey, long i) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:241</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html"><div class="ttname"><a href="classhelib_1_1_ctxt.html">helib::Ctxt</a></div><div class="ttdoc">A Ctxt object holds a single ciphertext.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:270</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a79103ed28e86f05ca8c141758b6bcac9"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a79103ed28e86f05ca8c141758b6bcac9">helib::EncryptedArrayCx::EncryptedArrayCx</a></div><div class="ttdeci">EncryptedArrayCx(const Context &amp;_context, const PAlgebraModCx &amp;_alMod)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:701</div></div>
<div class="ttc" id="anamespacehelib_html_a877d5bbaf6ad7ef25042c6711e6a6aa2"><div class="ttname"><a href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">helib::convert</a></div><div class="ttdeci">void convert(long &amp;x1, const NTL::GF2X &amp;x2)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:358</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a7b2d7b9513ab362cc501444c80caf1b9"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a7b2d7b9513ab362cc501444c80caf1b9">helib::EncryptedArrayCx::decrypt</a></div><div class="ttdeci">void decrypt(UNUSED const Ctxt &amp;ctxt, UNUSED const SecKey &amp;sKey, UNUSED PlaintextArray &amp;ptxt) const override</div><div class="ttdoc">Unimplemented decrypt function for BGV. It will always throw helib::LogicError.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:902</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_cx_html"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_cx.html">helib::PAlgebraModCx</a></div><div class="ttdef"><b>Definition:</b> PAlgebra.h:757</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_a80f94a3b909e8092520f5c263f66996d"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#a80f94a3b909e8092520f5c263f66996d">helib::PlaintextArray::print</a></div><div class="ttdeci">void print(std::ostream &amp;s) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1454</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_base_html_a953777c1f618b3f77cb06981f39dce99"><div class="ttname"><a href="classhelib_1_1_encrypted_array_base.html#a953777c1f618b3f77cb06981f39dce99">helib::EncryptedArrayBase::getContext</a></div><div class="ttdeci">virtual const Context &amp; getContext() const =0</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a334aac82a4217163cd7f3e0a8da7eb9b"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a334aac82a4217163cd7f3e0a8da7eb9b">helib::EncryptedArrayDerived::restoreContextForG</a></div><div class="ttdeci">virtual void restoreContextForG() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:419</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_ab2662cc935cd36e0adc8eb52eb8546ee"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#ab2662cc935cd36e0adc8eb52eb8546ee">helib::EncryptedArray::dispatch</a></div><div class="ttdeci">void dispatch(Args &amp;&amp;... args) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1285</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a13112446e3d1596d974b51c3d1da8ba7"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a13112446e3d1596d974b51c3d1da8ba7">helib::EncryptedArrayCx::convert</a></div><div class="ttdeci">static void convert(std::vector&lt; long &gt; &amp;out, const std::vector&lt; cx_double &gt; &amp;in)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:728</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a540b5ea6214812fa2414044923c3a035"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a540b5ea6214812fa2414044923c3a035">helib::EncryptedArrayDerived::initNormalBasisMatrix</a></div><div class="ttdeci">void initNormalBasisMatrix() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:485</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a4c41f5c4c4efad7ab4f395c476ad86a3"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a4c41f5c4c4efad7ab4f395c476ad86a3">helib::EncryptedArrayCx::encode</a></div><div class="ttdeci">double encode(zzX &amp;out, const Ptxt&lt; Scheme &gt; &amp;ptxt, double useThisSize, long precision=-1) const</div><div class="ttdoc">Encode a Ptxt object into a zzX.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:959</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_derived_html_a2c3372b943c4e332dd32365457c0be58"><div class="ttname"><a href="classhelib_1_1_plaintext_array_derived.html#a2c3372b943c4e332dd32365457c0be58">helib::PlaintextArrayDerived::print</a></div><div class="ttdeci">virtual void print(std::ostream &amp;s) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1406</div></div>
<div class="ttc" id="aclasshelib_1_1_mapping_data_html_aedaecfbec10f647a8bfafee57c4f5b9f"><div class="ttname"><a href="classhelib_1_1_mapping_data.html#aedaecfbec10f647a8bfafee57c4f5b9f">helib::MappingData::getG</a></div><div class="ttdeci">const RX &amp; getG() const</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:494</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a8c9c54b75a6f13a32c5c71157477d6a4"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a8c9c54b75a6f13a32c5c71157477d6a4">helib::EncryptedArrayCx::shift1D</a></div><div class="ttdeci">void shift1D(Ctxt &amp;ctxt, long i, long k) const override</div><div class="ttdoc">Right shift k positions along the i'th dimension with zero fill.</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:115</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a9741ce6601a5d07c83283beeff6cc7e0"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a9741ce6601a5d07c83283beeff6cc7e0">helib::EncryptedArrayDerived::getTab</a></div><div class="ttdeci">const PAlgebraModDerived&lt; type &gt; &amp; getTab() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:430</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_derived_html"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_derived.html">helib::PAlgebraModDerived</a></div><div class="ttdoc">A concrete instantiation of the virtual class.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:468</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a100aaeeedbaf9219fd000f912242a98b"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a100aaeeedbaf9219fd000f912242a98b">helib::EncryptedArray::EncryptedArray</a></div><div class="ttdeci">EncryptedArray(const Context &amp;context, const PAlgebraMod &amp;_alMod)</div><div class="ttdoc">constructor: G defaults to F0, PAlgebraMod explicitly given</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1248</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a1f1568cce42e1f8b91d9edceb5b8329a"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a1f1568cce42e1f8b91d9edceb5b8329a">helib::EncryptedArrayDerived::getTag</a></div><div class="ttdeci">virtual PA_tag getTag() const override</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:391</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_aabf7802b8dbea7aede4c27daeb98166f"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#aabf7802b8dbea7aede4c27daeb98166f">helib::EncryptedArray::getPAlgebra</a></div><div class="ttdeci">const PAlgebra &amp; getPAlgebra() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1307</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a3ace019165a5f26bc7fa0a2528324a15"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a3ace019165a5f26bc7fa0a2528324a15">helib::EncryptedArrayCx::encrypt</a></div><div class="ttdeci">void encrypt(Ctxt &amp;ctxt, const PubKey &amp;key, const PTXT &amp;ptxt, double useThisSize, long precision=-1) const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1003</div></div>
<div class="ttc" id="anamespacehelib_html_acf194ed39fc9a3694d1a11a0cd4c75d4"><div class="ttname"><a href="namespacehelib.html#acf194ed39fc9a3694d1a11a0cd4c75d4">helib::buildEncryptedArray</a></div><div class="ttdeci">EncryptedArrayBase * buildEncryptedArray(const Context &amp;context, const PAlgebraMod &amp;alMod, const NTL::ZZX &amp;G=NTL::ZZX::zero())</div><div class="ttdoc">A &quot;factory&quot; for building EncryptedArrays.</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:23</div></div>
<div class="ttc" id="aclasshelib_1_1_plaintext_array_html_aee891154a87c72eb80d3ba309f3f3e54"><div class="ttname"><a href="classhelib_1_1_plaintext_array.html#aee891154a87c72eb80d3ba309f3f3e54">helib::PlaintextArray::PlaintextArray</a></div><div class="ttdeci">PlaintextArray(const EncryptedArray &amp;ea)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1430</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html_ab261446cf0a635a7bf1edf081df48d81"><div class="ttname"><a href="classhelib_1_1_context.html#ab261446cf0a635a7bf1edf081df48d81">helib::Context::zMStar</a></div><div class="ttdeci">PAlgebra zMStar</div><div class="ttdoc">The structure of Zm*.</div><div class="ttdef"><b>Definition:</b> Context.h:68</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a9d770aef7c5a653d705f29a359187578"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a9d770aef7c5a653d705f29a359187578">helib::EncryptedArrayCx::getiEncoded</a></div><div class="ttdeci">const zzX &amp; getiEncoded() const</div><div class="ttdef"><b>Definition:</b> EaCx.cpp:175</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_cx_html_a614df6336a69dd08830bebfcfb34a5a8"><div class="ttname"><a href="classhelib_1_1_encrypted_array_cx.html#a614df6336a69dd08830bebfcfb34a5a8">helib::EncryptedArrayCx::encodeRoundingError</a></div><div class="ttdeci">double encodeRoundingError() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1036</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html_a2e615f01bff3cd2a1f679e419343eeed"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html#a2e615f01bff3cd2a1f679e419343eeed">helib::EncryptedArray::getTag</a></div><div class="ttdeci">PA_tag getTag() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1282</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_derived_html_a5ae779d5f0fd91f5d5846d5fc1d4fc15"><div class="ttname"><a href="classhelib_1_1_encrypted_array_derived.html#a5ae779d5f0fd91f5d5846d5fc1d4fc15">helib::EncryptedArrayDerived::getNormalBasisMatrix</a></div><div class="ttdeci">const NTL::Mat&lt; R &gt; &amp; getNormalBasisMatrix() const</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:402</div></div>
<div class="ttc" id="aclasshelib_1_1_p_algebra_mod_cx_html_a9df1389f699003bf1579b22efb4cc546"><div class="ttname"><a href="classhelib_1_1_p_algebra_mod_cx.html#a9df1389f699003bf1579b22efb4cc546">helib::PAlgebraModCx::getR</a></div><div class="ttdeci">long getR() const override</div><div class="ttdoc">The value r.</div><div class="ttdef"><b>Definition:</b> PAlgebra.h:774</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
